|
Hi All,
I would like to write out an ASCII file of frequency data to be used by another software program. I think I could figure this out with a little time, but I am guessing that someone here can probably solve this problem in a few seconds. The data will always consist of ascending integers with zero as the minimum value. I’d like to take SPSS output that would look something like this:
Valid frequency 0 51 1 69 2 34 3 50 4 23 5 16
and turn it into an ASCII file that looks like this (space delimted – the number of spaces does not matter):
51 69 34 50 23 16
I do not want the 0,1,2,3, etc., values to write to the ASCII file, but the frequencies do need to be ordered by those values.
If possible, I’d also like to be able to run multiple variable frequencies at the same time that would write out to different rows in the ASCII file.
For example,
Variable 1:
Valid frequency 0 51 1 69 2 34 3 50 4 23
Variable 2:
Valid frequency 0 10 1 5 2 12
Would become:
51 69 34 50 23 10 5 12
in the ASCII file.
Any help would be greatly appreciated.
Best,
Rick
|
|
There are many ways to go about this, but
here is one that results in a dataset with just the information you want.
DATASET DECLARE freqs. AGGREGATE /OUTFILE='freqs' /BREAK=educ /N_BREAK=N. DELETE VARIABLES educ. DATASET ACTIVATE freqs. FLIP VARIABLES=N_BREAK. DATASET NAME educ. If you do this repeatedly, you could use ADD FILES to put these datasets together and then use WRITE or save as text to join them all or save them individually as text and use a DOS copy command to append them all. I'd be concerned, though, that there might be empty or different numbers of categories with different variables so things might not line up. If there might sometimes be zeros, this approach won't work. HTH, Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: "Handel, Richard W." <[hidden email]> To: [hidden email], Date: 12/16/2012 08:13 AM Subject: [SPSSX-L] Writing frequencies to an ASCII file Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi All, I would like to write out an ASCII file of frequency data to be used by another software program. I think I could figure this out with a little time, but I am guessing that someone here can probably solve this problem in a few seconds. The data will always consist of ascending integers with zero as the minimum value. I’d like to take SPSS output that would look something like this: Valid frequency 0 51 1 69 2 34 3 50 4 23 5 16 and turn it into an ASCII file that looks like this (space delimted – the number of spaces does not matter): 51 69 34 50 23 16 I do not want the 0,1,2,3, etc., values to write to the ASCII file, but the frequencies do need to be ordered by those values. If possible, I’d also like to be able to run multiple variable frequencies at the same time that would write out to different rows in the ASCII file. For example, Variable 1: Valid frequency 0 51 1 69 2 34 3 50 4 23 Variable 2: Valid frequency 0 10 1 5 2 12 Would become: 51 69 34 50 23 10 5 12 in the ASCII file. Any help would be greatly appreciated. Best, Rick |
|
In reply to this post by Handel, Richard W.
I don’t have a complete solution worked out but a starting point would be to use aggregate to group on the variable and save the N as your frequency variable, flip the file, and write the row into a text file. From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Handel, Richard W. Hi All, I would like to write out an ASCII file of frequency data to be used by another software program. I think I could figure this out with a little time, but I am guessing that someone here can probably solve this problem in a few seconds. The data will always consist of ascending integers with zero as the minimum value. I’d like to take SPSS output that would look something like this: Valid frequency 0 51 1 69 2 34 3 50 4 23 5 16 and turn it into an ASCII file that looks like this (space delimted – the number of spaces does not matter): 51 69 34 50 23 16 I do not want the 0,1,2,3, etc., values to write to the ASCII file, but the frequencies do need to be ordered by those values. If possible, I’d also like to be able to run multiple variable frequencies at the same time that would write out to different rows in the ASCII file. For example, Variable 1: Valid frequency 0 51 1 69 2 34 3 50 4 23 Variable 2: Valid frequency 0 10 1 5 2 12 Would become: 51 69 34 50 23 10 5 12 in the ASCII file. Any help would be greatly appreciated. Best, Rick |
|
In reply to this post by Handel, Richard W.
I do not have the time
to test this at the moment but see if something like this does what you
need. If change var020(0,10)
to var020(0,n) where n is highest category number for any
variable.
compute constant =1. procedure output outfile ='c:\project\freqs..txt'. crosstabs variables = Var001 to var020 (0,10) constant(0,1) tables = var001 to var020 by constant /write = cells. P.s. Is it possible that whatever you are planning to do in another program could be doen in SPSS? Art Kendall Social Research ConsultantsOn 12/16/2012 10:11 AM, Handel, Richard W. wrote:
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Art Kendall
Social Research Consultants |
|
Administrator
|
In reply to this post by Handel, Richard W.
"I think I could figure this out with a little time..."
-- Outline: VARSTOCASES. VECTOR.. COMPUTE (see FM). AGGREGATE. WRITE . EXE. ---
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
|
Thanks for your help, everyone! Art, yes, I am sure it could be done in SPSS, but the other program is already written. Thanks again, everyone.
Rick ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Administrator
|
What does the other program do? It may already be written for SPSS too.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
|
In reply to this post by Jon K Peck
Hi all,
I am just getting back to this task that I posted about last month. The syntax that Jon provided below does do what I need to do . However, unfortunately, it is the case that I could have zeros at times. Is there an easy way to modify the syntax below to handle counts of zero? For example, what if the integers ranged from 0 to 10 in an ascending order and I needed frequencies for all values in the ASCII file some of which may be zero? For those interested, I am looking at raw score frequencies on a psychological scale. The frequencies are for the number of individuals who obtained a given raw score, so if no one obtained a raw score greater than 7, for example, I'd still need to output zeros for raw score values of 8, 9, and 10. Thanks in advance for any help! Best, Rick Handel From: Jon K Peck [[hidden email]]
Sent: Sunday, December 16, 2012 10:49 AM To: Handel, Richard W. Cc: [hidden email] Subject: Re: [SPSSX-L] Writing frequencies to an ASCII file There are many ways to go about this, but here is one that results in a dataset with just the information you want.
DATASET DECLARE freqs. AGGREGATE /OUTFILE='freqs' /BREAK=educ /N_BREAK=N. DELETE VARIABLES educ. DATASET ACTIVATE freqs. FLIP VARIABLES=N_BREAK. DATASET NAME educ. If you do this repeatedly, you could use ADD FILES to put these datasets together and then use WRITE or save as text to join them all or save them individually as text and use a DOS copy command to append them all. I'd be concerned, though, that there might be empty or different numbers of categories with different variables so things might not line up. If there might sometimes be zeros, this approach won't work. HTH, Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: "Handel, Richard W." <[hidden email]> To: [hidden email], Date: 12/16/2012 08:13 AM Subject: [SPSSX-L] Writing frequencies to an ASCII file Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi All, I would like to write out an ASCII file of frequency data to be used by another software program. I think I could figure this out with a little time, but I am guessing that someone here can probably solve this problem in a few seconds. The data will always consist of ascending integers with zero as the minimum value. I’d like to take SPSS output that would look something like this: Valid frequency 0 51 1 69 2 34 3 50 4 23 5 16 and turn it into an ASCII file that looks like this (space delimted – the number of spaces does not matter): 51 69 34 50 23 16 I do not want the 0,1,2,3, etc., values to write to the ASCII file, but the frequencies do need to be ordered by those values. If possible, I’d also like to be able to run multiple variable frequencies at the same time that would write out to different rows in the ASCII file. For example, Variable 1: Valid frequency 0 51 1 69 2 34 3 50 4 23 Variable 2: Valid frequency 0 10 1 5 2 12 Would become: 51 69 34 50 23 10 5 12 in the ASCII file. Any help would be greatly appreciated. Best, Rick |
|
Three approaches
1) Create a dataset with one variable with ten cases and any value. Use ADD FILES to combine with the main dataset. Run the code below, but after activating the aggregated dataset, subtract one from each value using COMPUTE 2) If you have Custom Tables, define value labels for all ten possible values, do a frequency table using CTABLES specifying to include empty cells, and use OMS to catch the table as a dataset. Then drop the unnecessary variables. 3) Use a simple Python program to accumulate results and generate the text file. HTH, Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: "Handel, Richard W." <[hidden email]> To: Jon K Peck/Chicago/IBM@IBMUS, Cc: "[hidden email]" <[hidden email]> Date: 01/18/2013 04:05 PM Subject: RE: [SPSSX-L] Writing frequencies to an ASCII file Hi all, I am just getting back to this task that I posted about last month. The syntax that Jon provided below does do what I need to do . However, unfortunately, it is the case that I could have zeros at times. Is there an easy way to modify the syntax below to handle counts of zero? For example, what if the integers ranged from 0 to 10 in an ascending order and I needed frequencies for all values in the ASCII file some of which may be zero? For those interested, I am looking at raw score frequencies on a psychological scale. The frequencies are for the number of individuals who obtained a given raw score, so if no one obtained a raw score greater than 7, for example, I'd still need to output zeros for raw score values of 8, 9, and 10. Thanks in advance for any help! Best, Rick Handel From: Jon K Peck [[hidden email]] Sent: Sunday, December 16, 2012 10:49 AM To: Handel, Richard W. Cc: [hidden email] Subject: Re: [SPSSX-L] Writing frequencies to an ASCII file There are many ways to go about this, but here is one that results in a dataset with just the information you want. DATASET DECLARE freqs. AGGREGATE /OUTFILE='freqs' /BREAK=educ /N_BREAK=N. DELETE VARIABLES educ. DATASET ACTIVATE freqs. FLIP VARIABLES=N_BREAK. DATASET NAME educ. If you do this repeatedly, you could use ADD FILES to put these datasets together and then use WRITE or save as text to join them all or save them individually as text and use a DOS copy command to append them all. I'd be concerned, though, that there might be empty or different numbers of categories with different variables so things might not line up. If there might sometimes be zeros, this approach won't work. HTH, Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: "Handel, Richard W." <[hidden email]> To: [hidden email], Date: 12/16/2012 08:13 AM Subject: [SPSSX-L] Writing frequencies to an ASCII file Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi All, I would like to write out an ASCII file of frequency data to be used by another software program. I think I could figure this out with a little time, but I am guessing that someone here can probably solve this problem in a few seconds. The data will always consist of ascending integers with zero as the minimum value. I’d like to take SPSS output that would look something like this: Valid frequency 0 51 1 69 2 34 3 50 4 23 5 16 and turn it into an ASCII file that looks like this (space delimted – the number of spaces does not matter): 51 69 34 50 23 16 I do not want the 0,1,2,3, etc., values to write to the ASCII file, but the frequencies do need to be ordered by those values. If possible, I’d also like to be able to run multiple variable frequencies at the same time that would write out to different rows in the ASCII file. For example, Variable 1: Valid frequency 0 51 1 69 2 34 3 50 4 23 Variable 2: Valid frequency 0 10 1 5 2 12 Would become: 51 69 34 50 23 10 5 12 in the ASCII file. Any help would be greatly appreciated. Best, Rick |
|
Administrator
|
I will just add a sketchy version 4? and leave it to OP to flesh out the specifics:
VARSTOCASES (create an index to track which variable). AGGREGATE (hint: use the var index and values as break and N as function). CASESTOVARS. WRITE. EXE. General for any number of variables! No OMS, No Python, No Kidding!!!
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
|
In reply to this post by Handel, Richard W.
Thanks, Jon!
Rick
Sent from my Samsung Epic™ 4G Touch
Jon K Peck <[hidden email]> wrote: Three approaches 1) Create a dataset with one variable with ten cases and any value. Use ADD FILES to combine with the main dataset. Run the code below, but after activating the aggregated dataset, subtract one from each value using COMPUTE 2) If you have Custom Tables, define value labels for all ten possible values, do a frequency table using CTABLES specifying to include empty cells, and use OMS to catch the table as a dataset. Then drop the unnecessary variables. 3) Use a simple Python program to accumulate results and generate the text file. HTH, Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: "Handel, Richard W." <[hidden email]> To: Jon K Peck/Chicago/IBM@IBMUS, Cc: "[hidden email]" <[hidden email]> Date: 01/18/2013 04:05 PM Subject: RE: [SPSSX-L] Writing frequencies to an ASCII file Hi all, I am just getting back to this task that I posted about last month. The syntax that Jon provided below does do what I need to do . However, unfortunately, it is the case that I could have zeros at times. Is there an easy way to modify the syntax below to handle counts of zero? For example, what if the integers ranged from 0 to 10 in an ascending order and I needed frequencies for all values in the ASCII file some of which may be zero? For those interested, I am looking at raw score frequencies on a psychological scale. The frequencies are for the number of individuals who obtained a given raw score, so if no one obtained a raw score greater than 7, for example, I'd still need to output zeros for raw score values of 8, 9, and 10. Thanks in advance for any help! Best, Rick Handel From: Jon K Peck [[hidden email]] Sent: Sunday, December 16, 2012 10:49 AM To: Handel, Richard W. Cc: [hidden email] Subject: Re: [SPSSX-L] Writing frequencies to an ASCII file There are many ways to go about this, but here is one that results in a dataset with just the information you want. DATASET DECLARE freqs. AGGREGATE /OUTFILE='freqs' /BREAK=educ /N_BREAK=N. DELETE VARIABLES educ. DATASET ACTIVATE freqs. FLIP VARIABLES=N_BREAK. DATASET NAME educ. If you do this repeatedly, you could use ADD FILES to put these datasets together and then use WRITE or save as text to join them all or save them individually as text and use a DOS copy command to append them all. I'd be concerned, though, that there might be empty or different numbers of categories with different variables so things might not line up. If there might sometimes be zeros, this approach won't work. HTH, Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: "Handel, Richard W." <[hidden email]> To: [hidden email], Date: 12/16/2012 08:13 AM Subject: [SPSSX-L] Writing frequencies to an ASCII file Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi All, I would like to write out an ASCII file of frequency data to be used by another software program. I think I could figure this out with a little time, but I am guessing that someone here can probably solve this problem in a few seconds. The data will always consist of ascending integers with zero as the minimum value. I’d like to take SPSS output that would look something like this: Valid frequency 0 51 1 69 2 34 3 50 4 23 5 16 and turn it into an ASCII file that looks like this (space delimted – the number of spaces does not matter): 51 69 34 50 23 16 I do not want the 0,1,2,3, etc., values to write to the ASCII file, but the frequencies do need to be ordered by those values. If possible, I’d also like to be able to run multiple variable frequencies at the same time that would write out to different rows in the ASCII file. For example, Variable 1: Valid frequency 0 51 1 69 2 34 3 50 4 23 Variable 2: Valid frequency 0 10 1 5 2 12 Would become: 51 69 34 50 23 10 5 12 in the ASCII file. Any help would be greatly appreciated. Best, Rick |
|
In reply to this post by David Marso
Thanks, David! I'll give this a shot too.
Rick ________________________________________ From: SPSSX(r) Discussion [[hidden email]] on behalf of David Marso [[hidden email]] Sent: Friday, January 18, 2013 7:20 PM To: [hidden email] Subject: Re: Writing frequencies to an ASCII file I will just add a sketchy version 4? and leave it to OP to flesh out the specifics: VARSTOCASES (create an index to track which variable). AGGREGATE (hint: use the var index and values as break and N as function). CASESTOVARS. WRITE. EXE. General for any number of variables! No OMS, No Python, No Kidding!!! Jon K Peck wrote > Three approaches > 1) Create a dataset with one variable with ten cases and any value. > Use ADD FILES to combine with the main dataset. > Run the code below, but after activating the aggregated dataset, subtract > one from each value using COMPUTE > > 2) If you have Custom Tables, define value labels for all ten possible > values, do a frequency table using CTABLES specifying to include empty > cells, and use OMS to catch the table as a dataset. Then drop the > unnecessary variables. > > 3) Use a simple Python program to accumulate results and generate the text > file. > > HTH, > > Jon Peck (no "h") aka Kim > Senior Software Engineer, IBM > peck@.ibm > new phone: 720-342-5621 > > > > > From: "Handel, Richard W." < > HandelRW@ > > > To: Jon K Peck/Chicago/IBM@IBMUS, > Cc: " > SPSSX-L@.uga > " < > SPSSX-L@.uga > > > Date: 01/18/2013 04:05 PM > Subject: RE: [SPSSX-L] Writing frequencies to an ASCII file > > > > Hi all, > > I am just getting back to this task that I posted about last month. The > syntax that Jon provided below does do what I need to do . However, > unfortunately, it is the case that I could have zeros at times. Is there > an easy way to modify the syntax below to handle counts of zero? For > example, what if the integers ranged from 0 to 10 in an ascending order > and I needed frequencies for all values in the ASCII file some of which > may be zero? For those interested, I am looking at raw score frequencies > on a psychological scale. The frequencies are for the number of > individuals who obtained a given raw score, so if no one obtained a raw > score greater than 7, for example, I'd still need to output zeros for raw > score values of 8, 9, and 10. Thanks in advance for any help! > > Best, > > Rick Handel > > > > > From: Jon K Peck [ > peck@.ibm > ] > Sent: Sunday, December 16, 2012 10:49 AM > To: Handel, Richard W. > Cc: > SPSSX-L@.uga > Subject: Re: [SPSSX-L] Writing frequencies to an ASCII file > > There are many ways to go about this, but here is one that results in a > dataset with just the information you want. > DATASET DECLARE freqs. > AGGREGATE > /OUTFILE='freqs' > /BREAK=educ > /N_BREAK=N. > DELETE VARIABLES educ. > DATASET ACTIVATE freqs. > FLIP VARIABLES=N_BREAK. > DATASET NAME educ. > > If you do this repeatedly, you could use ADD FILES to put these datasets > together and then use WRITE or save as text to join them all or save them > individually as text and use a DOS copy command to append them all. > > I'd be concerned, though, that there might be empty or different numbers > of categories with different variables so things might not line up. If > there might sometimes be zeros, this approach won't work. > > HTH, > > Jon Peck (no "h") aka Kim > Senior Software Engineer, IBM > peck@.ibm > new phone: 720-342-5621 > > > > > From: "Handel, Richard W." < > HandelRW@ > > > To: > SPSSX-L@.uga > , > Date: 12/16/2012 08:13 AM > Subject: [SPSSX-L] Writing frequencies to an ASCII file > Sent by: "SPSSX(r) Discussion" < > SPSSX-L@.uga > > > > > > Hi All, > > I would like to write out an ASCII file of frequency data to be used by > another software program. I think I could figure this out with a little > time, but I am guessing that someone here can probably solve this problem > in a few seconds. The data will always consist of ascending integers with > zero as the minimum value. I’d like to take SPSS output that would look > something like this: > > Valid frequency > 0 51 > 1 69 > 2 34 > 3 50 > 4 23 > 5 16 > > > and turn it into an ASCII file that looks like this (space delimted – the > number of spaces does not matter): > > 51 69 34 50 23 16 > > > I do not want the 0,1,2,3, etc., values to write to the ASCII file, but > the frequencies do need to be ordered by those values. > > > If possible, I’d also like to be able to run multiple variable frequencies > at the same time that would write out to different rows in the ASCII file. > > > For example, > > Variable 1: > > Valid frequency > 0 51 > 1 69 > 2 34 > 3 50 > 4 23 > > > Variable 2: > > Valid frequency > 0 10 > 1 5 > 2 12 > > > Would become: > > 51 69 34 50 23 > 10 5 12 > > in the ASCII file. > > Any help would be greatly appreciated. > > Best, > > Rick ----- Please reply to the list and not to my personal email. Those desiring my consulting or training services please feel free to email me. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Writing-frequencies-to-an-ASCII-file-tp5716967p5717532.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Administrator
|
Here is a 'fleshy' version.
-- * Simulate raw data *. INPUT PROGRAM. LOOP CASEID=1 TO 60000. DO REPEAT v=v001 to v120. compute v=trunc(uniform(11)). END REPEAT. END CASE. END LOOP. END FILE. END INPUT PROGRAM. EXE. VARSTOCASES /MAKE trans1 FROM v001 TO v120 /INDEX = Var(trans1) /KEEP = caseid. AGGREGATE OUTFILE * / BREAK var trans1 / N=N. FORMATS Trans1 (N2). CASESTOVARS /ID = var /INDEX = trans1. FORMATS n.00 TO n.10 (F8.0). WRITE OUTFILE "C:\TEMP\Tabs.txt" / n.00 TO n.10. EXE.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
|
I'll try it. Thanks again!
Rick ________________________________________ From: SPSSX(r) Discussion [[hidden email]] on behalf of David Marso [[hidden email]] Sent: Saturday, January 19, 2013 4:12 PM To: [hidden email] Subject: Re: Writing frequencies to an ASCII file Here is a 'fleshy' version. -- * Simulate raw data *. INPUT PROGRAM. LOOP CASEID=1 TO 60000. DO REPEAT v=v001 to v120. compute v=trunc(uniform(11)). END REPEAT. END CASE. END LOOP. END FILE. END INPUT PROGRAM. EXE. VARSTOCASES /MAKE trans1 FROM v001 TO v120 /INDEX = Var(trans1) /KEEP = caseid. AGGREGATE OUTFILE * / BREAK var trans1 / N=N. FORMATS Trans1 (N2). CASESTOVARS /ID = var /INDEX = trans1. FORMATS n.00 TO n.10 (F8.0). WRITE OUTFILE "C:\TEMP\Tabs.txt" / n.00 TO n.10. EXE. Handel, Richard W. wrote > Thanks, David! I'll give this a shot too. > > Rick > > ________________________________________ > From: SPSSX(r) Discussion [ > SPSSX-L@.UGA > ] on behalf of David Marso [ > david.marso@ > ] > Sent: Friday, January 18, 2013 7:20 PM > To: > SPSSX-L@.UGA > Subject: Re: Writing frequencies to an ASCII file > > I will just add a sketchy version 4? and leave it to OP to flesh out the > specifics: > > VARSTOCASES (create an index to track which variable). > AGGREGATE (hint: use the var index and values as break and N as function). > CASESTOVARS. > WRITE. > EXE. > > General for any number of variables! > No OMS, No Python, No Kidding!!! > > > Jon K Peck wrote >> Three approaches >> 1) Create a dataset with one variable with ten cases and any value. >> Use ADD FILES to combine with the main dataset. >> Run the code below, but after activating the aggregated dataset, subtract >> one from each value using COMPUTE >> >> 2) If you have Custom Tables, define value labels for all ten possible >> values, do a frequency table using CTABLES specifying to include empty >> cells, and use OMS to catch the table as a dataset. Then drop the >> unnecessary variables. >> >> 3) Use a simple Python program to accumulate results and generate the >> text >> file. > >> HTH, >> Jon Peck (no "h") aka Kim >> Senior Software Engineer, IBM >> peck@.ibm >> new phone: 720-342-5621 ----- Please reply to the list and not to my personal email. Those desiring my consulting or training services please feel free to email me. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Writing-frequencies-to-an-ASCII-file-tp5716967p5717537.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
