|
Hi all,
I would like to have the dataset below (1) look like dataset (2). (1) ID MAJOR DEGREETYPE PRIMARY 1 BIOLOGY BA Y 1 CHEMISTRY MINOR N 2 POLI SCI BA Y 3 MATH BA Y 3 STATISTICS CONC N 4 HISTORY BA Y 4 HUMANITIES BA N 5 ANATOMY BA Y 5 CHEMISTRY BA N 5 BIOLOGY BA N (2) ID MAJOR1 MAJOR2 MAJOR3 MAJOR4 MINOR CONCENTRATION 1 BIOLOGY CHEMISTRY 2 POLI SCI 3 MATH STATISTICS 4 HISTORY HUMANITIES 5 ANATOMY CHEMISTRY BIOLOGY If Primary = 'Y' then that major should always belong in Major1. If the degreetype is Conc that major should always go into concentration. If the degreetype is minor that major should always go into Minor. If degreetype is not conc and primary = N, then the majors should go in order, Major 2, Major 3, Major 4. Sorry, if not clear, the example above is probably better to look at. Thanks, Keval ====================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 |
|
Hi Keval,
The syntax below is tested and works. The first SORT CASES command is important because it sorts the majors with the primary majors first before restructuring the data. If there were multiple primary majors, they would be ordered alphabetically from left to right i.e. Major.1 Anatomy, Major.2 Chemistry, Major.3 Humanities etc. I also included the possibility of a BS degree. Take it easy, Ari DATA LIST LIST /ID (F8) Major (A12) DegreeType (A5) Primary (A1). BEGIN DATA 1 BIOLOGY BA Y 1 CHEMISTRY MINOR N 2 POLISCI BA Y 3 MATH BA Y 3 STATISTICS CONC N 4 HISTORY BA Y 4 HUMANITIES BA N 5 ANATOMY BA Y 5 CHEMISTRY BA N 5 BIOLOGY BA N END DATA. DATASET NAME Original. ************************************************. DATASET COPY Major. DATASET ACTIVATE Major. SELECT IF ANY(DegreeTYPE,'BA','BS'). EXE. SORT CASES BY ID (A) Primary (D) Major (A). CASESTOVARS /ID=ID /GROUPBY=VARIABLE. ************************************************. DATASET ACTIVATE Original. DATASET COPY Minor_Concentration. DATASET ACTIVATE Minor_Concentration. SELECT IF (NOT(ANY(DegreeTYPE,'BA','BS'))). EXE. DELETE VARIABLE Primary. STRING MINOR (A12) CONC (A12). IF DegreeType='MINOR' MINOR=Major. IF DegreeType='CONC' CONC=Major. EXE. DELETE VARIABLES Major DegreeType. ************************************************. DATASET ACTIVATE Major. MATCH FILES /FILE=* /TABLE='Minor_Concentration' /BY ID. EXECUTE. DATASET CLOSE ALL. DATASET NAME Final. ************************************************. On Tue, Nov 11, 2008 at 5:18 PM, Keval Khichadia <[hidden email]>wrote: > Hi all, > > I would like to have the dataset below (1) look like dataset (2). > > (1) > > ID MAJOR DEGREETYPE PRIMARY > > 1 BIOLOGY > BA Y > 1 CHEMISTRY MINOR N > 2 POLI SCI BA > Y > 3 MATH BA > Y > > 3 STATISTICS CONC N > 4 HISTORY > BA Y > 4 HUMANITIES BA > N > 5 ANATOMY BA > Y > 5 > CHEMISTRY BA N > 5 BIOLOGY > BA N > > > > (2) > > ID MAJOR1 MAJOR2 MAJOR3 MAJOR4 MINOR > CONCENTRATION > > 1 BIOLOGY > CHEMISTRY > 2 POLI SCI > > 3 MATH STATISTICS > 4 HISTORY HUMANITIES > 5 ANATOMY CHEMISTRY BIOLOGY > > > If Primary = 'Y' then that major should always belong in Major1. If the > degreetype is Conc that major should always go into concentration. If the > degreetype is minor that major should always go into Minor. If degreetype is > not conc and primary = N, then the majors should go in order, Major 2, Major > 3, Major 4. Sorry, if not clear, the example above is probably better to > look at. > > > Thanks, > > Keval > > > > > 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 |
|
Hi all
I need your help to resolve this problem. I have a term based file with status of full- or part-time (f or p) for each semester. I need to categorize a case as full-time, if it the case enrolled as full-time in any of the terms. I was able to create a unique_status using a sort and unduplicated logic. For example, case #2 occus three times for three consecutive semsters, and the case was full-time twice and part-time once, therefore the case is considered full-time for its unique status. However, the unique_status is associated with the case as it occurs for the first time for a term , and the unique_status is missing for the same case if it occurs for multiple terms. Although I think I am pretty close to the solution I think I am missing some logic to calculate the total amount by id by unique_status. Here is what the data set looks like: ID term Status unique_status Amount 1 fall07 f f 10 2 fall 07 f f 20 2 spring08 f . 30 2 summer 08 p . 10 3 fall 07 p p 20 3 winter 07 p . 40 3 spring08 p . 20 3 summer08 p . 10 4 fall07 f f 50 4 spring08 p . 20 5 summer07 p p 10 5 fall07 p . 30 5 spring08 p . 20 I need to calculate the total amount for each case by unique status,i.e., Total Amount for all full-time students (sum for cases 1, 2 and 4) = 10+20+30+10+50+20 = 140. Although case 2 and 4 have part-time status in some semesters. Total Amount for all partime students (sum for case 3 and 5) = 20+40+20+10+10+30+20 = 150. I appreciate any suggestions to resolve the last piece of the puzzle. Many Thanks G. Khaneja ===================== 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 |
|
Hi all
I need your help to resolve this problem. I have a term based file with status of full- or part-time (f or p) for each semester. I need to categorize a case as full-time, if the case is enrolled as full-time in any of the terms. I was able to create a unique_status using a sort and unduplicated logic. For example, case #2 occus three times for three consecutive semsters, and the case was full-time twice and part-time once, therefore the case is considered full-time for its unique status. However, the unique_status is associated with the case as it occurs for the first time for a term , and the unique_status is missing for the same case if it occurs for multiple terms. Is there a way to fill the missing field for each id with it's unique value. Although I think I am pretty close to the solution I think I am missing some logic to calculate the total amount by id by unique_status. Here is what the data set looks like: ID term Status unique_status Amount 1 fall07 f f 10 2 fall 07 f f 20 2 spring08 f . 30 2 summer 08 p . 10 3 fall 07 p p 20 3 winter 07 p . 40 3 spring08 p . 20 3 summer08 p . 10 4 fall07 f f 50 4 spring08 p . 20 5 summer07 p p 10 5 fall07 p . 30 5 spring08 p . 20 If I get the misiing data in place, I can calculate the total amount for each case by unique status,i.e., Total Amount for all full-time students (sum for cases 1, 2 and 4) = 10+20+30+10+50+20 = 140. Although case 2 and 4 have part-time status in some semesters. Total Amount for all partime students (sum for case 3 and 5) = 20+40+20+10+10+30+20 = 150. I appreciate any suggestions to resolve the last piece of the puzzle. My apologies if you are seeing the posting again. Many Thanks G. Khaneja ===================== 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 |
|
Hi Gurvinder,
* recode the f/p status into 1/0 numbers * use aggregate procedure (Data -> Aggregate...) by ID (seeking of the full-time status corresponds to seeking a maximum in the logic of aggregate) * recode back if needed Aggregate can be probably used also for computing of the sums. HTH Jan -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Khaneja, Gurvinder Sent: Thursday, November 13, 2008 1:49 PM To: [hidden email] Subject: Re: Help with copying unique status by multiple ID's Hi all I need your help to resolve this problem. I have a term based file with status of full- or part-time (f or p) for each semester. I need to categorize a case as full-time, if the case is enrolled as full-time in any of the terms. I was able to create a unique_status using a sort and unduplicated logic. For example, case #2 occus three times for three consecutive semsters, and the case was full-time twice and part-time once, therefore the case is considered full-time for its unique status. However, the unique_status is associated with the case as it occurs for the first time for a term , and the unique_status is missing for the same case if it occurs for multiple terms. Is there a way to fill the missing field for each id with it's unique value. Although I think I am pretty close to the solution I think I am missing some logic to calculate the total amount by id by unique_status. Here is what the data set looks like: ID term Status unique_status Amount 1 fall07 f f 10 2 fall 07 f f 20 2 spring08 f . 30 2 summer 08 p . 10 3 fall 07 p p 20 3 winter 07 p . 40 3 spring08 p . 20 3 summer08 p . 10 4 fall07 f f 50 4 spring08 p . 20 5 summer07 p p 10 5 fall07 p . 30 5 spring08 p . 20 If I get the misiing data in place, I can calculate the total amount for each case by unique status,i.e., Total Amount for all full-time students (sum for cases 1, 2 and 4) = 10+20+30+10+50+20 = 140. Although case 2 and 4 have part-time status in some semesters. Total Amount for all partime students (sum for case 3 and 5) = 20+40+20+10+10+30+20 = 150. I appreciate any suggestions to resolve the last piece of the puzzle. My apologies if you are seeing the posting again. Many Thanks G. Khaneja ===================== 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 _____________ Tato zpráva a všechny připojené soubory jsou důvěrné a určené výlučně adresátovi(-ům). Jestliže nejste oprávněným adresátem, je zakázáno jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto informací. Jestliže jste tento mail dostali neoprávněně, prosím, uvědomte odesilatele a smažte zprávu i přiložené soubory. Odesilatel nezodpovídá za jakékoliv chyby nebo opomenutí způsobené tímto přenosem. Jste si jisti, že opravdu potřebujete vytisknout tuto zprávu a/nebo její přílohy? Myslete na přírodu. This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the message as well as all attached documents. The sender does not accept liability for any errors or omissions as a result of the transmission. Are you sure that you really need a print version of this message and/or its attachments? Think about nature. -.- -- ===================== 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 |
|
In reply to this post by ariel barak
Hi listers,
I have a question that sounds to be simple but I really cannot figure out: how to write a syntax that can autosave the working data file to its current location without specifying the path. The files have already been named. I use version v12 to run monthly stuff, I normally copy the files to a new month's folder & manually change the file names then run some update on the data...It is troublesome to change the path in the syntax every time. If forget to do so, it overwrites the previous month data. Any input is much appreciated! Hop ----- Original Message ----- From: "Ariel Barak" <[hidden email]> To: <[hidden email]> Sent: Wednesday, November 12, 2008 11:34 AM Subject: Re: cases to vars > Hi Keval, > > The syntax below is tested and works. The first SORT CASES command is > important because it sorts the majors with the primary majors first before > restructuring the data. If there were multiple primary majors, they would > be > ordered alphabetically from left to right i.e. Major.1 Anatomy, Major.2 > Chemistry, Major.3 Humanities etc. I also included the possibility of a BS > degree. > > Take it easy, > Ari > > > > DATA LIST LIST /ID (F8) Major (A12) DegreeType (A5) Primary (A1). > BEGIN DATA > 1 BIOLOGY BA Y > 1 CHEMISTRY MINOR N > 2 POLISCI BA Y > 3 MATH BA Y > 3 STATISTICS CONC N > 4 HISTORY BA Y > 4 HUMANITIES BA N > 5 ANATOMY BA Y > 5 CHEMISTRY BA N > 5 BIOLOGY BA N > END DATA. > > DATASET NAME Original. > ************************************************. > DATASET COPY Major. > DATASET ACTIVATE Major. > > SELECT IF ANY(DegreeTYPE,'BA','BS'). > EXE. > > SORT CASES BY ID (A) Primary (D) Major (A). > CASESTOVARS > /ID=ID > /GROUPBY=VARIABLE. > ************************************************. > DATASET ACTIVATE Original. > > DATASET COPY Minor_Concentration. > DATASET ACTIVATE Minor_Concentration. > > SELECT IF (NOT(ANY(DegreeTYPE,'BA','BS'))). > EXE. > > DELETE VARIABLE Primary. > > STRING MINOR (A12) CONC (A12). > IF DegreeType='MINOR' MINOR=Major. > IF DegreeType='CONC' CONC=Major. > EXE. > > DELETE VARIABLES Major DegreeType. > ************************************************. > DATASET ACTIVATE Major. > > MATCH FILES /FILE=* > /TABLE='Minor_Concentration' > /BY ID. > EXECUTE. > > DATASET CLOSE ALL. > DATASET NAME Final. > ************************************************. > > On Tue, Nov 11, 2008 at 5:18 PM, Keval Khichadia > <[hidden email]>wrote: > >> Hi all, >> >> I would like to have the dataset below (1) look like dataset (2). >> >> (1) >> >> ID MAJOR DEGREETYPE PRIMARY >> >> 1 BIOLOGY >> BA Y >> 1 CHEMISTRY MINOR N >> 2 POLI SCI BA >> Y >> 3 MATH BA >> Y >> >> 3 STATISTICS CONC >> N >> 4 HISTORY >> BA Y >> 4 HUMANITIES BA >> N >> 5 ANATOMY BA >> Y >> 5 >> CHEMISTRY BA N >> 5 BIOLOGY >> BA N >> >> >> >> (2) >> >> ID MAJOR1 MAJOR2 MAJOR3 MAJOR4 >> MINOR >> CONCENTRATION >> >> 1 BIOLOGY >> CHEMISTRY >> 2 POLI SCI >> >> 3 MATH >> STATISTICS >> 4 HISTORY HUMANITIES >> 5 ANATOMY CHEMISTRY BIOLOGY >> >> >> If Primary = 'Y' then that major should always belong in Major1. If the >> degreetype is Conc that major should always go into concentration. If the >> degreetype is minor that major should always go into Minor. If degreetype >> is >> not conc and primary = N, then the majors should go in order, Major 2, >> Major >> 3, Major 4. Sorry, if not clear, the example above is probably better to >> look at. >> >> >> Thanks, >> >> Keval >> >> >> >> >> 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 ===================== 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 |
|
The easiest way to do this is to specify the paths with a file handle. Then you only need to redefine the directory for that handle, and the rest of the job will refer to the new location.
FILE HANDLE was enhanced a few releases ago - after 12.0, I think, but the older version should suffice for your needs. HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Thien Hop Sent: Thursday, November 13, 2008 7:38 PM To: [hidden email] Subject: [SPSSX-L] Auto saving data Hi listers, I have a question that sounds to be simple but I really cannot figure out: how to write a syntax that can autosave the working data file to its current location without specifying the path. The files have already been named. I use version v12 to run monthly stuff, I normally copy the files to a new month's folder & manually change the file names then run some update on the data...It is troublesome to change the path in the syntax every time. If forget to do so, it overwrites the previous month data. Any input is much appreciated! Hop ----- Original Message ----- From: "Ariel Barak" <[hidden email]> To: <[hidden email]> Sent: Wednesday, November 12, 2008 11:34 AM Subject: Re: cases to vars > Hi Keval, > > The syntax below is tested and works. The first SORT CASES command is > important because it sorts the majors with the primary majors first before > restructuring the data. If there were multiple primary majors, they would > be > ordered alphabetically from left to right i.e. Major.1 Anatomy, Major.2 > Chemistry, Major.3 Humanities etc. I also included the possibility of a BS > degree. > > Take it easy, > Ari > > > > DATA LIST LIST /ID (F8) Major (A12) DegreeType (A5) Primary (A1). > BEGIN DATA > 1 BIOLOGY BA Y > 1 CHEMISTRY MINOR N > 2 POLISCI BA Y > 3 MATH BA Y > 3 STATISTICS CONC N > 4 HISTORY BA Y > 4 HUMANITIES BA N > 5 ANATOMY BA Y > 5 CHEMISTRY BA N > 5 BIOLOGY BA N > END DATA. > > DATASET NAME Original. > ************************************************. > DATASET COPY Major. > DATASET ACTIVATE Major. > > SELECT IF ANY(DegreeTYPE,'BA','BS'). > EXE. > > SORT CASES BY ID (A) Primary (D) Major (A). > CASESTOVARS > /ID=ID > /GROUPBY=VARIABLE. > ************************************************. > DATASET ACTIVATE Original. > > DATASET COPY Minor_Concentration. > DATASET ACTIVATE Minor_Concentration. > > SELECT IF (NOT(ANY(DegreeTYPE,'BA','BS'))). > EXE. > > DELETE VARIABLE Primary. > > STRING MINOR (A12) CONC (A12). > IF DegreeType='MINOR' MINOR=Major. > IF DegreeType='CONC' CONC=Major. > EXE. > > DELETE VARIABLES Major DegreeType. > ************************************************. > DATASET ACTIVATE Major. > > MATCH FILES /FILE=* > /TABLE='Minor_Concentration' > /BY ID. > EXECUTE. > > DATASET CLOSE ALL. > DATASET NAME Final. > ************************************************. > > On Tue, Nov 11, 2008 at 5:18 PM, Keval Khichadia > <[hidden email]>wrote: > >> Hi all, >> >> I would like to have the dataset below (1) look like dataset (2). >> >> (1) >> >> ID MAJOR DEGREETYPE PRIMARY >> >> 1 BIOLOGY >> BA Y >> 1 CHEMISTRY MINOR N >> 2 POLI SCI BA >> Y >> 3 MATH BA >> Y >> >> 3 STATISTICS CONC >> N >> 4 HISTORY >> BA Y >> 4 HUMANITIES BA >> N >> 5 ANATOMY BA >> Y >> 5 >> CHEMISTRY BA N >> 5 BIOLOGY >> BA N >> >> >> >> (2) >> >> ID MAJOR1 MAJOR2 MAJOR3 MAJOR4 >> MINOR >> CONCENTRATION >> >> 1 BIOLOGY >> CHEMISTRY >> 2 POLI SCI >> >> 3 MATH >> STATISTICS >> 4 HISTORY HUMANITIES >> 5 ANATOMY CHEMISTRY BIOLOGY >> >> >> If Primary = 'Y' then that major should always belong in Major1. If the >> degreetype is Conc that major should always go into concentration. If the >> degreetype is minor that major should always go into Minor. If degreetype >> is >> not conc and primary = N, then the majors should go in order, Major 2, >> Major >> 3, Major 4. Sorry, if not clear, the example above is probably better to >> look at. >> >> >> Thanks, >> >> Keval >> >> >> >> >> 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 ===================== 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 |
|
Hi,
Below is a simple script that works with FILE HANDLES. You can choose to write a given file to a directory that indicates the month (ie., 11 for november). Alternatively, you can time-stamp the file name (in ISO format) in addition to using a month dir. You just need to specify the base_dir and root_fn to your needs. Just run the entire syntax to see what happens. Cheers!! Albert-Jan begin program. import spss, time, os base_dir = "d:/temp" root_fn = "rootname" ymd = str(time.localtime()[0]) + str(time.localtime()[1]) + str(time.localtime()[2]) m_path = base_dir + "/" + str(time.localtime()[1]) try: if not os.path.exists(m_path): os.mkdir(m_path) print "*** m_path: %s" % m_path print "*** ymd: %s" % ymd spss.Submit("FILE HANDLE mydir / NAME = '%s'." % (m_path)) spss.Submit("FILE HANDLE myfile / NAME = '%s/%s_%s.sav'." % (m_path, root_fn, ymd)) spss.Submit("SHOW HANDLES.") except: raise Exception("** Directory already exists!") end program. get file = 'c:/program files/spss/employee data.sav'. save outfile = myfile. save outfile = 'mydir/somename.sav'. --- On Fri, 11/14/08, Peck, Jon <[hidden email]> wrote: > From: Peck, Jon <[hidden email]> > Subject: Re: Auto saving data > To: [hidden email] > Date: Friday, November 14, 2008, 4:29 AM > The easiest way to do this is to specify the paths with a > file handle. Then you only need to redefine the directory > for that handle, and the rest of the job will refer to the > new location. > > FILE HANDLE was enhanced a few releases ago - after 12.0, I > think, but the older version should suffice for your needs. > > HTH, > Jon Peck > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] > On Behalf Of Thien Hop > Sent: Thursday, November 13, 2008 7:38 PM > To: [hidden email] > Subject: [SPSSX-L] Auto saving data > > Hi listers, > > I have a question that sounds to be simple but I really > cannot figure out: > how to write a syntax that can autosave the working data > file to its > current location without specifying the path. The files > have already been > named. > > I use version v12 to run monthly stuff, I normally copy the > files to a new > month's folder & manually change the file names > then run some update on the > data...It is troublesome to change the path in the syntax > every time. If > forget to do so, it overwrites the previous month data. > > Any input is much appreciated! > > Hop > > > > > ----- Original Message ----- > From: "Ariel Barak" > <[hidden email]> > To: <[hidden email]> > Sent: Wednesday, November 12, 2008 11:34 AM > Subject: Re: cases to vars > > > > Hi Keval, > > > > The syntax below is tested and works. The first SORT > CASES command is > > important because it sorts the majors with the primary > majors first before > > restructuring the data. If there were multiple primary > majors, they would > > be > > ordered alphabetically from left to right i.e. Major.1 > Anatomy, Major.2 > > Chemistry, Major.3 Humanities etc. I also included the > possibility of a BS > > degree. > > > > Take it easy, > > Ari > > > > > > > > DATA LIST LIST /ID (F8) Major (A12) DegreeType (A5) > Primary (A1). > > BEGIN DATA > > 1 BIOLOGY BA Y > > 1 CHEMISTRY MINOR N > > 2 POLISCI BA Y > > 3 MATH BA Y > > 3 STATISTICS CONC N > > 4 HISTORY BA Y > > 4 HUMANITIES BA N > > 5 ANATOMY BA Y > > 5 CHEMISTRY BA N > > 5 BIOLOGY BA N > > END DATA. > > > > DATASET NAME Original. > > ************************************************. > > DATASET COPY Major. > > DATASET ACTIVATE Major. > > > > SELECT IF ANY(DegreeTYPE,'BA','BS'). > > EXE. > > > > SORT CASES BY ID (A) Primary (D) Major (A). > > CASESTOVARS > > /ID=ID > > /GROUPBY=VARIABLE. > > ************************************************. > > DATASET ACTIVATE Original. > > > > DATASET COPY Minor_Concentration. > > DATASET ACTIVATE Minor_Concentration. > > > > SELECT IF > (NOT(ANY(DegreeTYPE,'BA','BS'))). > > EXE. > > > > DELETE VARIABLE Primary. > > > > STRING MINOR (A12) CONC (A12). > > IF DegreeType='MINOR' MINOR=Major. > > IF DegreeType='CONC' CONC=Major. > > EXE. > > > > DELETE VARIABLES Major DegreeType. > > ************************************************. > > DATASET ACTIVATE Major. > > > > MATCH FILES /FILE=* > > /TABLE='Minor_Concentration' > > /BY ID. > > EXECUTE. > > > > DATASET CLOSE ALL. > > DATASET NAME Final. > > ************************************************. > > > > On Tue, Nov 11, 2008 at 5:18 PM, Keval Khichadia > > <[hidden email]>wrote: > > > >> Hi all, > >> > >> I would like to have the dataset below (1) look > like dataset (2). > >> > >> (1) > >> > >> ID MAJOR > DEGREETYPE PRIMARY > >> > >> 1 BIOLOGY > >> BA Y > >> 1 CHEMISTRY MINOR > N > >> 2 POLI SCI > BA > >> Y > >> 3 MATH > BA > >> Y > >> > >> 3 STATISTICS CONC > >> N > >> 4 HISTORY > >> BA Y > >> 4 HUMANITIES BA > >> N > >> 5 ANATOMY BA > >> Y > >> 5 > >> CHEMISTRY BA > N > >> 5 BIOLOGY > >> BA N > >> > >> > >> > >> (2) > >> > >> ID MAJOR1 MAJOR2 MAJOR3 > MAJOR4 > >> MINOR > >> CONCENTRATION > >> > >> 1 BIOLOGY > >> CHEMISTRY > >> 2 POLI SCI > >> > >> 3 MATH > >> STATISTICS > >> 4 HISTORY HUMANITIES > >> 5 ANATOMY CHEMISTRY BIOLOGY > >> > >> > >> If Primary = 'Y' then that major should > always belong in Major1. If the > >> degreetype is Conc that major should always go > into concentration. If the > >> degreetype is minor that major should always go > into Minor. If degreetype > >> is > >> not conc and primary = N, then the majors should > go in order, Major 2, > >> Major > >> 3, Major 4. Sorry, if not clear, the example above > is probably better to > >> look at. > >> > >> > >> Thanks, > >> > >> Keval > >> > >> > >> > >> > >> 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 > > ===================== > 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 ===================== 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 |
|
Hi Albert,
I tried this program below and it works beautifully if the path doesn't exist - thanks so much! However if the path exists, the except does not print anything and the save outfiles give errors. Any ideas? Thanks for your help, Amrita Singh -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Albert-jan Roskam Sent: Friday, November 14, 2008 4:34 AM To: [hidden email] Subject: Re: Auto saving data Hi, Below is a simple script that works with FILE HANDLES. You can choose to write a given file to a directory that indicates the month (ie., 11 for november). Alternatively, you can time-stamp the file name (in ISO format) in addition to using a month dir. You just need to specify the base_dir and root_fn to your needs. Just run the entire syntax to see what happens. Cheers!! Albert-Jan begin program. import spss, time, os base_dir = "d:/temp" root_fn = "rootname" ymd = str(time.localtime()[0]) + str(time.localtime()[1]) + str(time.localtime()[2]) m_path = base_dir + "/" + str(time.localtime()[1]) try: if not os.path.exists(m_path): os.mkdir(m_path) print "*** m_path: %s" % m_path print "*** ymd: %s" % ymd spss.Submit("FILE HANDLE mydir / NAME = '%s'." % (m_path)) spss.Submit("FILE HANDLE myfile / NAME = '%s/%s_%s.sav'." % (m_path, root_fn, ymd)) spss.Submit("SHOW HANDLES.") except: raise Exception("** Directory already exists!") end program. get file = 'c:/program files/spss/employee data.sav'. save outfile = myfile. save outfile = 'mydir/somename.sav'. --- On Fri, 11/14/08, Peck, Jon <[hidden email]> wrote: > From: Peck, Jon <[hidden email]> > Subject: Re: Auto saving data > To: [hidden email] > Date: Friday, November 14, 2008, 4:29 AM The easiest way to do this is > to specify the paths with a file handle. Then you only need to > redefine the directory for that handle, and the rest of the job will > refer to the new location. > > FILE HANDLE was enhanced a few releases ago - after 12.0, I think, but > the older version should suffice for your needs. > > HTH, > Jon Peck > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf > Of Thien Hop > Sent: Thursday, November 13, 2008 7:38 PM > To: [hidden email] > Subject: [SPSSX-L] Auto saving data > > Hi listers, > > I have a question that sounds to be simple but I really cannot figure > out: > how to write a syntax that can autosave the working data file to its > current location without specifying the path. The files have already > been named. > > I use version v12 to run monthly stuff, I normally copy the files to a > new month's folder & manually change the file names then run some > update on the data...It is troublesome to change the path in the > syntax every time. If forget to do so, it overwrites the previous > month data. > > Any input is much appreciated! > > Hop > > > > > ----- Original Message ----- > From: "Ariel Barak" > <[hidden email]> > To: <[hidden email]> > Sent: Wednesday, November 12, 2008 11:34 AM > Subject: Re: cases to vars > > > > Hi Keval, > > > > The syntax below is tested and works. The first SORT > CASES command is > > important because it sorts the majors with the primary > majors first before > > restructuring the data. If there were multiple primary > majors, they would > > be > > ordered alphabetically from left to right i.e. Major.1 > Anatomy, Major.2 > > Chemistry, Major.3 Humanities etc. I also included the > possibility of a BS > > degree. > > > > Take it easy, > > Ari > > > > > > > > DATA LIST LIST /ID (F8) Major (A12) DegreeType (A5) > Primary (A1). > > BEGIN DATA > > 1 BIOLOGY BA Y > > 1 CHEMISTRY MINOR N > > 2 POLISCI BA Y > > 3 MATH BA Y > > 3 STATISTICS CONC N > > 4 HISTORY BA Y > > 4 HUMANITIES BA N > > 5 ANATOMY BA Y > > 5 CHEMISTRY BA N > > 5 BIOLOGY BA N > > END DATA. > > > > DATASET NAME Original. > > ************************************************. > > DATASET COPY Major. > > DATASET ACTIVATE Major. > > > > SELECT IF ANY(DegreeTYPE,'BA','BS'). > > EXE. > > > > SORT CASES BY ID (A) Primary (D) Major (A). > > CASESTOVARS > > /ID=ID > > /GROUPBY=VARIABLE. > > ************************************************. > > DATASET ACTIVATE Original. > > > > DATASET COPY Minor_Concentration. > > DATASET ACTIVATE Minor_Concentration. > > > > SELECT IF > (NOT(ANY(DegreeTYPE,'BA','BS'))). > > EXE. > > > > DELETE VARIABLE Primary. > > > > STRING MINOR (A12) CONC (A12). > > IF DegreeType='MINOR' MINOR=Major. > > IF DegreeType='CONC' CONC=Major. > > EXE. > > > > DELETE VARIABLES Major DegreeType. > > ************************************************. > > DATASET ACTIVATE Major. > > > > MATCH FILES /FILE=* > > /TABLE='Minor_Concentration' > > /BY ID. > > EXECUTE. > > > > DATASET CLOSE ALL. > > DATASET NAME Final. > > ************************************************. > > > > On Tue, Nov 11, 2008 at 5:18 PM, Keval Khichadia > > <[hidden email]>wrote: > > > >> Hi all, > >> > >> I would like to have the dataset below (1) look > like dataset (2). > >> > >> (1) > >> > >> ID MAJOR > DEGREETYPE PRIMARY > >> > >> 1 BIOLOGY > >> BA Y > >> 1 CHEMISTRY MINOR > N > >> 2 POLI SCI > BA > >> Y > >> 3 MATH > BA > >> Y > >> > >> 3 STATISTICS CONC > >> N > >> 4 HISTORY > >> BA Y > >> 4 HUMANITIES BA > >> N > >> 5 ANATOMY BA > >> Y > >> 5 > >> CHEMISTRY BA > N > >> 5 BIOLOGY > >> BA N > >> > >> > >> > >> (2) > >> > >> ID MAJOR1 MAJOR2 MAJOR3 > MAJOR4 > >> MINOR > >> CONCENTRATION > >> > >> 1 BIOLOGY > >> CHEMISTRY > >> 2 POLI SCI > >> > >> 3 MATH > >> STATISTICS > >> 4 HISTORY HUMANITIES > >> 5 ANATOMY CHEMISTRY BIOLOGY > >> > >> > >> If Primary = 'Y' then that major should > always belong in Major1. If the > >> degreetype is Conc that major should always go > into concentration. If the > >> degreetype is minor that major should always go > into Minor. If degreetype > >> is > >> not conc and primary = N, then the majors should > go in order, Major 2, > >> Major > >> 3, Major 4. Sorry, if not clear, the example above > is probably better to > >> look at. > >> > >> > >> Thanks, > >> > >> Keval > >> > >> > >> > >> > >> 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 > > ===================== > 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 ===================== 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 |
|
In reply to this post by Khaneja, Gurvinder
Code posted here is tested.
At 11:38 PM 11/11/2008, Khaneja, Gurvinder wrote: >I think I am missing some logic to calculate the total amount by id >by unique_status. Here is what the data set looks like: |-----------------------------|---------------------------| |Output Created |14-NOV-2008 23:26:29 | |-----------------------------|---------------------------| [TestData] ID term Status unique_status Amount 1 fall07 f f 10 2 fall07 f f 20 2 spring08 f . 30 2 summer08 p . 10 3 fall07 p p 20 3 winter07 p . 40 3 spring08 p . 20 3 summer08 p . 10 4 fall07 f f 50 4 spring08 p . 20 5 summer07 p p 10 5 fall07 p . 30 5 spring08 p . 20 Number of cases read: 13 Number of cases listed: 13 * "I need to calculate the total amount for each case by unique . * status,i.e., . * . * Total Amount for all full-time students . * (sum for cases 1, 2 and 4) = 10+20+30+10+50+20 = 140. . * Although case 2 and 4 have part-time status in some semesters. . * Total Amount for all partime students . * (sum for case 3 and 5) = 20+40+20+10+10+30+20 = 150." . * Step I: Put student's unique status in every record for that . * student. . AGGREGATE /OUTFILE= * MODE=ADDVARIABLES OVERWRITE=YES /BREAK = ID /unique_status = MAX(unique_status). LIST. List |-----------------------------|---------------------------| |Output Created |14-NOV-2008 23:26:30 | |-----------------------------|---------------------------| [TestData] ID term Status Amount unique_status 1 fall07 f 10 f 2 fall07 f 20 f 2 spring08 f 30 f 2 summer08 p 10 f 3 fall07 p 20 p 3 winter07 p 40 p 3 spring08 p 20 p 3 summer08 p 10 p 4 fall07 f 50 f 4 spring08 p 20 f 5 summer07 p 10 p 5 fall07 p 30 p 5 spring08 p 20 p Number of cases read: 13 Number of cases listed: 13 * Step II: Total, by unique status . AGGREGATE /OUTFILE= * /BREAK=unique_status /TOTAL=SUM(Amount). LIST. List |-----------------------------|---------------------------| |Output Created |14-NOV-2008 23:26:31 | |-----------------------------|---------------------------| unique_status TOTAL f 140.00 p 150.00 Number of cases read: 2 Number of cases listed: 2 ============================ APPENDIX: Test data and code ============================ * C:\Documents and Settings\Richard\My Documents . * \Technical\spssx-l\Z-2008d . * \2008-11-11 Khaneja - Re-cases to vars.SPS . * In response to posting * Date: Tue, 11 Nov 2008 23:38:48 -0500 . * From: "Khaneja, Gurvinder" <[hidden email]> . * Subject: Re: cases to vars . * To: [hidden email] . * ................................................................. . * ................. Test data ..................... . * (Statement of the requirement follows the listing of test data) . DATA LIST LIST/ ID term Status unique_status Amount (F2, A10, A1, A1, F4). BEGIN DATA 1 fall07 f f 10 2 fall07 f f 20 2 spring08 f . 30 2 summer08 p . 10 3 fall07 p p 20 3 winter07 p . 40 3 spring08 p . 20 3 summer08 p . 10 4 fall07 f f 50 4 spring08 p . 20 5 summer07 p p 10 5 fall07 p . 30 5 spring08 p . 20 END DATA. DATASET NAME TestData WINDOW=FRONT. * ................. Post after this point ..................... . * ................................................................. . LIST. * "I need to calculate the total amount for each case by unique . * status,i.e., . * . * Total Amount for all full-time students . * (sum for cases 1, 2 and 4) = 10+20+30+10+50+20 = 140. . * Although case 2 and 4 have part-time status in some semesters. . * Total Amount for all partime students . * (sum for case 3 and 5) = 20+40+20+10+10+30+20 = 150." . * Step I: Put student's unique status in every record for that . * student. . AGGREGATE /OUTFILE= * MODE=ADDVARIABLES OVERWRITE=YES /BREAK = ID /unique_status = MAX(unique_status). LIST. * Step II: Total, by unique status . AGGREGATE /OUTFILE= * /BREAK=unique_status /TOTAL=SUM(Amount). LIST. ===================== 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 |
|
In reply to this post by Albert-Jan Roskam
Hi Albert,
Thanks for your syntax but when I ran it, error message cam up as follows: >Error # 1. Command name: Begin >The first word in the line is not recognized as an SPSS command. >This command not executed. >Error # 101. Command name: import >This command is not allowed in the set of file definition commands. Either >complete the definition of the file, or use the NEW FILE command to discard >the partial file definition. >This command not executed. Please advise. Thanks a lot! Hop ----- Original Message ----- From: "Albert-jan Roskam" <[hidden email]> To: <[hidden email]> Sent: Friday, November 14, 2008 5:33 PM Subject: Re: Auto saving data > Hi, > > Below is a simple script that works with FILE HANDLES. You can choose to > write a given file to a directory that indicates the month (ie., 11 for > november). Alternatively, you can time-stamp the file name (in ISO format) > in addition to using a month dir. You just need to specify the base_dir > and root_fn to your needs. Just run the entire syntax to see what happens. > > Cheers!! > Albert-Jan > > begin program. > import spss, time, os > base_dir = "d:/temp" > root_fn = "rootname" > ymd = str(time.localtime()[0]) + str(time.localtime()[1]) + > str(time.localtime()[2]) > m_path = base_dir + "/" + str(time.localtime()[1]) > try: > if not os.path.exists(m_path): > os.mkdir(m_path) > print "*** m_path: %s" % m_path > print "*** ymd: %s" % ymd > spss.Submit("FILE HANDLE mydir / NAME = '%s'." % (m_path)) > spss.Submit("FILE HANDLE myfile / NAME = '%s/%s_%s.sav'." % > (m_path, root_fn, ymd)) > spss.Submit("SHOW HANDLES.") > except: > raise Exception("** Directory already exists!") > end program. > > get file = 'c:/program files/spss/employee data.sav'. > save outfile = myfile. > save outfile = 'mydir/somename.sav'. > > > > --- On Fri, 11/14/08, Peck, Jon <[hidden email]> wrote: > >> From: Peck, Jon <[hidden email]> >> Subject: Re: Auto saving data >> To: [hidden email] >> Date: Friday, November 14, 2008, 4:29 AM >> The easiest way to do this is to specify the paths with a >> file handle. Then you only need to redefine the directory >> for that handle, and the rest of the job will refer to the >> new location. >> >> FILE HANDLE was enhanced a few releases ago - after 12.0, I >> think, but the older version should suffice for your needs. >> >> HTH, >> Jon Peck >> >> -----Original Message----- >> From: SPSSX(r) Discussion [mailto:[hidden email]] >> On Behalf Of Thien Hop >> Sent: Thursday, November 13, 2008 7:38 PM >> To: [hidden email] >> Subject: [SPSSX-L] Auto saving data >> >> Hi listers, >> >> I have a question that sounds to be simple but I really >> cannot figure out: >> how to write a syntax that can autosave the working data >> file to its >> current location without specifying the path. The files >> have already been >> named. >> >> I use version v12 to run monthly stuff, I normally copy the >> files to a new >> month's folder & manually change the file names >> then run some update on the >> data...It is troublesome to change the path in the syntax >> every time. If >> forget to do so, it overwrites the previous month data. >> >> Any input is much appreciated! >> >> Hop >> >> >> >> >> ----- Original Message ----- >> From: "Ariel Barak" >> <[hidden email]> >> To: <[hidden email]> >> Sent: Wednesday, November 12, 2008 11:34 AM >> Subject: Re: cases to vars >> >> >> > Hi Keval, >> > >> > The syntax below is tested and works. The first SORT >> CASES command is >> > important because it sorts the majors with the primary >> majors first before >> > restructuring the data. If there were multiple primary >> majors, they would >> > be >> > ordered alphabetically from left to right i.e. Major.1 >> Anatomy, Major.2 >> > Chemistry, Major.3 Humanities etc. I also included the >> possibility of a BS >> > degree. >> > >> > Take it easy, >> > Ari >> > >> > >> > >> > DATA LIST LIST /ID (F8) Major (A12) DegreeType (A5) >> Primary (A1). >> > BEGIN DATA >> > 1 BIOLOGY BA Y >> > 1 CHEMISTRY MINOR N >> > 2 POLISCI BA Y >> > 3 MATH BA Y >> > 3 STATISTICS CONC N >> > 4 HISTORY BA Y >> > 4 HUMANITIES BA N >> > 5 ANATOMY BA Y >> > 5 CHEMISTRY BA N >> > 5 BIOLOGY BA N >> > END DATA. >> > >> > DATASET NAME Original. >> > ************************************************. >> > DATASET COPY Major. >> > DATASET ACTIVATE Major. >> > >> > SELECT IF ANY(DegreeTYPE,'BA','BS'). >> > EXE. >> > >> > SORT CASES BY ID (A) Primary (D) Major (A). >> > CASESTOVARS >> > /ID=ID >> > /GROUPBY=VARIABLE. >> > ************************************************. >> > DATASET ACTIVATE Original. >> > >> > DATASET COPY Minor_Concentration. >> > DATASET ACTIVATE Minor_Concentration. >> > >> > SELECT IF >> (NOT(ANY(DegreeTYPE,'BA','BS'))). >> > EXE. >> > >> > DELETE VARIABLE Primary. >> > >> > STRING MINOR (A12) CONC (A12). >> > IF DegreeType='MINOR' MINOR=Major. >> > IF DegreeType='CONC' CONC=Major. >> > EXE. >> > >> > DELETE VARIABLES Major DegreeType. >> > ************************************************. >> > DATASET ACTIVATE Major. >> > >> > MATCH FILES /FILE=* >> > /TABLE='Minor_Concentration' >> > /BY ID. >> > EXECUTE. >> > >> > DATASET CLOSE ALL. >> > DATASET NAME Final. >> > ************************************************. >> > >> > On Tue, Nov 11, 2008 at 5:18 PM, Keval Khichadia >> > <[hidden email]>wrote: >> > >> >> Hi all, >> >> >> >> I would like to have the dataset below (1) look >> like dataset (2). >> >> >> >> (1) >> >> >> >> ID MAJOR >> DEGREETYPE PRIMARY >> >> >> >> 1 BIOLOGY >> >> BA Y >> >> 1 CHEMISTRY MINOR >> N >> >> 2 POLI SCI >> BA >> >> Y >> >> 3 MATH >> BA >> >> Y >> >> >> >> 3 STATISTICS CONC >> >> N >> >> 4 HISTORY >> >> BA Y >> >> 4 HUMANITIES BA >> >> N >> >> 5 ANATOMY BA >> >> Y >> >> 5 >> >> CHEMISTRY BA >> N >> >> 5 BIOLOGY >> >> BA N >> >> >> >> >> >> >> >> (2) >> >> >> >> ID MAJOR1 MAJOR2 MAJOR3 >> MAJOR4 >> >> MINOR >> >> CONCENTRATION >> >> >> >> 1 BIOLOGY >> >> CHEMISTRY >> >> 2 POLI SCI >> >> >> >> 3 MATH >> >> STATISTICS >> >> 4 HISTORY HUMANITIES >> >> 5 ANATOMY CHEMISTRY BIOLOGY >> >> >> >> >> >> If Primary = 'Y' then that major should >> always belong in Major1. If the >> >> degreetype is Conc that major should always go >> into concentration. If the >> >> degreetype is minor that major should always go >> into Minor. If degreetype >> >> is >> >> not conc and primary = N, then the majors should >> go in order, Major 2, >> >> Major >> >> 3, Major 4. Sorry, if not clear, the example above >> is probably better to >> >> look at. >> >> >> >> >> >> Thanks, >> >> >> >> Keval >> >> >> >> >> >> >> >> >> >> 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 >> >> ===================== >> 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 > > ===================== > 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 |
|
In reply to this post by Khaneja, Gurvinder
At 07:48 AM 11/13/2008, Khaneja, Gurvinder wrote:
>I need your help to resolve this problem. I have a term based file >with status of full- or part-time (f or p) for each semester. Ah, this is the same request you posted Tue, 11 Nov 2008 23:38:48, under subject line "Re: cases to vars"? On Fri, 14 Nov 2008 23:33:13 I posted a solution, also under subject head ""Re: cases to vars". Check that solution, and post again if there are any difficulties. -Best of luck, Richard ===================== 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 |
|
In reply to this post by Singh, Amrita
Hi Amrita and Hop,
Amrita, below is a slightly modified script. The only thing different is the indentation after the IF clause. I ran it a couple of times and didn't get any error messages. Please email me off-list if the listserv messes up the code too much (ie., the indentations). Hop, it seems like you don't have Python and the Spss plugin for Python installed. Therefore, the command BEGIN PROGRAM-END PROGRAM has no 'meaning' on your computer yet. On www.spss.com you can find information on how to do this. The plugin version depends on your spss version, check these details carefully. It's quite easy. You do need admin rights to install those programs. Cheers!! Albert-Jan begin program. import spss, time, os base_dir = "d:/temp" root_fn = "rootname" ymd = str(time.localtime()[0]) + str(time.localtime()[1]) + str(time.localtime()[2]) m_path = base_dir + "/" + str(time.localtime()[1]) try: if not os.path.exists(m_path): os.mkdir(m_path) spss.Submit("FILE HANDLE mydir / NAME = '%s'." % (m_path)) spss.Submit("FILE HANDLE myfile / NAME = '%s/%s_%s.sav'." % (m_path, root_fn, ymd)) spss.Submit("SHOW HANDLES.") except: raise Exception("** Directory already exists!") end program. get file = 'c:/program files/spss/employee data.sav'. save outfile = myfile. save outfile = 'mydir/somename.sav'. --- On Fri, 11/14/08, Singh, Amrita <[hidden email]> wrote: > From: Singh, Amrita <[hidden email]> > Subject: Re: Auto saving data > To: [hidden email] > Date: Friday, November 14, 2008, 5:28 PM > Hi Albert, > > I tried this program below and it works beautifully if the > path doesn't > exist - thanks so much! > > However if the path exists, the except does not print > anything and the > save outfiles give errors. Any ideas? > > Thanks for your help, > Amrita Singh > > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] > On Behalf Of > Albert-jan Roskam > Sent: Friday, November 14, 2008 4:34 AM > To: [hidden email] > Subject: Re: Auto saving data > > Hi, > > Below is a simple script that works with FILE HANDLES. You > can choose to > write a given file to a directory that indicates the month > (ie., 11 for > november). Alternatively, you can time-stamp the file name > (in ISO > format) in addition to using a month dir. You just need to > specify the > base_dir and root_fn to your needs. Just run the entire > syntax to see > what happens. > > Cheers!! > Albert-Jan > > begin program. > import spss, time, os > base_dir = "d:/temp" > root_fn = "rootname" > ymd = str(time.localtime()[0]) + > str(time.localtime()[1]) + > str(time.localtime()[2]) > m_path = base_dir + "/" + > str(time.localtime()[1]) > try: > if not os.path.exists(m_path): > os.mkdir(m_path) > print "*** m_path: %s" % m_path > print "*** ymd: %s" % ymd > spss.Submit("FILE HANDLE mydir / NAME = > '%s'." % (m_path)) > spss.Submit("FILE HANDLE myfile / NAME = > '%s/%s_%s.sav'." % > (m_path, root_fn, ymd)) > spss.Submit("SHOW HANDLES.") > except: > raise Exception("** Directory already > exists!") end program. > > get file = 'c:/program files/spss/employee > data.sav'. > save outfile = myfile. > save outfile = 'mydir/somename.sav'. > > > > --- On Fri, 11/14/08, Peck, Jon <[hidden email]> > wrote: > > > From: Peck, Jon <[hidden email]> > > Subject: Re: Auto saving data > > To: [hidden email] > > Date: Friday, November 14, 2008, 4:29 AM The easiest > way to do this is > > > to specify the paths with a file handle. Then you > only need to > > redefine the directory for that handle, and the rest > of the job will > > refer to the new location. > > > > FILE HANDLE was enhanced a few releases ago - after > 12.0, I think, but > > > the older version should suffice for your needs. > > > > HTH, > > Jon Peck > > > > -----Original Message----- > > From: SPSSX(r) Discussion > [mailto:[hidden email]] On Behalf > > Of Thien Hop > > Sent: Thursday, November 13, 2008 7:38 PM > > To: [hidden email] > > Subject: [SPSSX-L] Auto saving data > > > > Hi listers, > > > > I have a question that sounds to be simple but I > really cannot figure > > out: > > how to write a syntax that can autosave the working > data file to its > > current location without specifying the path. The > files have already > > been named. > > > > I use version v12 to run monthly stuff, I normally > copy the files to a > > > new month's folder & manually change the file > names then run some > > update on the data...It is troublesome to change the > path in the > > syntax every time. If forget to do so, it overwrites > the previous > > month data. > > > > Any input is much appreciated! > > > > Hop > > > > > > > > > > ----- Original Message ----- > > From: "Ariel Barak" > > <[hidden email]> > > To: <[hidden email]> > > Sent: Wednesday, November 12, 2008 11:34 AM > > Subject: Re: cases to vars > > > > > > > Hi Keval, > > > > > > The syntax below is tested and works. The first > SORT > > CASES command is > > > important because it sorts the majors with the > primary > > majors first before > > > restructuring the data. If there were multiple > primary > > majors, they would > > > be > > > ordered alphabetically from left to right i.e. > Major.1 > > Anatomy, Major.2 > > > Chemistry, Major.3 Humanities etc. I also > included the > > possibility of a BS > > > degree. > > > > > > Take it easy, > > > Ari > > > > > > > > > > > > DATA LIST LIST /ID (F8) Major (A12) DegreeType > (A5) > > Primary (A1). > > > BEGIN DATA > > > 1 BIOLOGY BA Y > > > 1 CHEMISTRY MINOR N > > > 2 POLISCI BA Y > > > 3 MATH BA Y > > > 3 STATISTICS CONC N > > > 4 HISTORY BA Y > > > 4 HUMANITIES BA N > > > 5 ANATOMY BA Y > > > 5 CHEMISTRY BA N > > > 5 BIOLOGY BA N > > > END DATA. > > > > > > DATASET NAME Original. > > > ************************************************. > > > DATASET COPY Major. > > > DATASET ACTIVATE Major. > > > > > > SELECT IF > ANY(DegreeTYPE,'BA','BS'). > > > EXE. > > > > > > SORT CASES BY ID (A) Primary (D) Major (A). > > > CASESTOVARS > > > /ID=ID > > > /GROUPBY=VARIABLE. > > > ************************************************. > > > DATASET ACTIVATE Original. > > > > > > DATASET COPY Minor_Concentration. > > > DATASET ACTIVATE Minor_Concentration. > > > > > > SELECT IF > > (NOT(ANY(DegreeTYPE,'BA','BS'))). > > > EXE. > > > > > > DELETE VARIABLE Primary. > > > > > > STRING MINOR (A12) CONC (A12). > > > IF DegreeType='MINOR' MINOR=Major. > > > IF DegreeType='CONC' CONC=Major. > > > EXE. > > > > > > DELETE VARIABLES Major DegreeType. > > > ************************************************. > > > DATASET ACTIVATE Major. > > > > > > MATCH FILES /FILE=* > > > /TABLE='Minor_Concentration' > > > /BY ID. > > > EXECUTE. > > > > > > DATASET CLOSE ALL. > > > DATASET NAME Final. > > > ************************************************. > > > > > > On Tue, Nov 11, 2008 at 5:18 PM, Keval Khichadia > > > <[hidden email]>wrote: > > > > > >> Hi all, > > >> > > >> I would like to have the dataset below (1) > look > > like dataset (2). > > >> > > >> (1) > > >> > > >> ID MAJOR > > DEGREETYPE PRIMARY > > >> > > >> 1 BIOLOGY > > >> BA Y > > >> 1 CHEMISTRY > MINOR > > N > > >> 2 POLI SCI > > BA > > >> Y > > >> 3 MATH > > BA > > >> Y > > >> > > >> 3 STATISTICS > CONC > > >> N > > >> 4 HISTORY > > >> BA Y > > >> 4 HUMANITIES > BA > > >> N > > >> 5 ANATOMY > BA > > >> Y > > >> 5 > > >> CHEMISTRY BA > > N > > >> 5 BIOLOGY > > >> BA N > > >> > > >> > > >> > > >> (2) > > >> > > >> ID MAJOR1 MAJOR2 MAJOR3 > > MAJOR4 > > >> MINOR > > >> CONCENTRATION > > >> > > >> 1 BIOLOGY > > >> CHEMISTRY > > >> 2 POLI SCI > > >> > > >> 3 MATH > > >> STATISTICS > > >> 4 HISTORY HUMANITIES > > >> 5 ANATOMY CHEMISTRY BIOLOGY > > >> > > >> > > >> If Primary = 'Y' then that major > should > > always belong in Major1. If the > > >> degreetype is Conc that major should always > go > > into concentration. If the > > >> degreetype is minor that major should always > go > > into Minor. If degreetype > > >> is > > >> not conc and primary = N, then the majors > should > > go in order, Major 2, > > >> Major > > >> 3, Major 4. Sorry, if not clear, the example > above > > is probably better to > > >> look at. > > >> > > >> > > >> Thanks, > > >> > > >> Keval > > >> > > >> > > >> > > >> > > >> 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 > > > > ===================== > > 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 > > ===================== > 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 ===================== 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 |
|
In reply to this post by Richard Ristow
Hi all,
I have started using SPSS version 17 and as routine, when I tried to read in data from text file using the Text Import wizard (using my saved *.tpf file), it does not go beyond step 4 . Step 5 shows a blank screen. I tried going back to SPSS version 16 and it works. Am I missing something or is there a bug in the new software? Please advice. G. Khaneja ===================== 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 |
|
Hello,
If the .tpf was saved from an earlier SPSS version, then you will need to recreate the format in SPSS 17. As noted in the resolution which I've pasted below (from http://support.spss.com ), the code for creating tpf and sql files was changed extensively in SPSS 17. David Matheson SPSS Statistical Support **************************** Resolution number: 79341 Created on: Aug 26 2008 Last Reviewed on: Sep 22 2008 Problem Subject: Saved tpf or spq files cannot be opened with later versions of SPSS Statistics. Problem Description: I have saved a query (spq) from the Database Wizard using SPSS 16.0.x (or earlier). I try to open my saved ODBC query in SPSS Statistics 17.0.x. -or- I have saved a text file format file (tpf) from the Text Import Wizard using SPSS 16.0.x. I try to open text using my saved TPF file. I get the following error the next time I try to edit the query again: The query file '--File Path--' could not be opened. The file format may be incompatible with the installed version of SPSS. How can I fix this? Resolution Subject: This problem has been reported to SPSS Development - No Workaround Available Resolution Description: Unfortunately, the code for these two functions needed to be completely rewritten in SPSS Statistics 17.0. Due to this fact, SPSS Statistics 17.0.x will not be able to read TPF and SPQ files created from SPSS 16 or earlier versions. Please recreate your queries or predefined formats in SPSS 17.0. This allows for saved queries from SPSS 17 Statistics to be opened in subsequent releases when they occur. We apologize for the inconvenience. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Khaneja, Gurvinder Sent: Monday, November 17, 2008 9:49 AM To: [hidden email] Subject: Re: Using SPSS Import Wizard to read text data Hi all, I have started using SPSS version 17 and as routine, when I tried to read in data from text file using the Text Import wizard (using my saved *.tpf file), it does not go beyond step 4 . Step 5 shows a blank screen. I tried going back to SPSS version 16 and it works. Am I missing something or is there a bug in the new software? Please advice. G. Khaneja ===================== 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 |
|
A general rule about SPSS
1. The newer the version the worse the import facilities 16 on the mac is absolutely dire, will not correctly import from .xslx for m any files, as it makes weird incorrect guesses Slightly better with .xls, BUT STILL can¹t parse space in a variable name STILL can¹t use upper & lower case, or special characters in variable names STILL can¹t have string use string variable data starting with a number All the above are VERY easy to fix by a competent programmer, about 2 days work All fixed in versions of JMP & other user friendly programmes at least a decade ago. 2. The newer the version the worse the interface to the graph functions, and the fewer the options Please keep legacy graphs much quicker and more flexible One just fills in x, & y axes and categroical grouoing factors for colour and pattern Also dialogues no longer permit changes to line width All that programming effort waste on making life difficult for ysuers as they slowly drag variables to axes. I¹d really like a response from SPSS themselves on all this SPSS is to be congratulated on improved computational functionality Why is interface so appalling and getting WORSE Why are so many useful graph tailoring functions disappearing from dialogue interface? SPSS please answer Best Diana On 17/11/2008 17:55, "SPSS Support" <[hidden email]> wrote: > Hello, > If the .tpf was saved from an earlier SPSS version, then you will need to > recreate the format in SPSS 17. As noted in the resolution which I've pasted > below (from http://support.spss.com ), the code for creating tpf and sql files > was changed extensively in SPSS 17. > > David Matheson > SPSS Statistical Support > **************************** > > Resolution number: 79341 Created on: Aug 26 2008 Last Reviewed on: Sep 22 > 2008 > > Problem Subject: Saved tpf or spq files cannot be opened with later versions > of SPSS Statistics. > > Problem Description: I have saved a query (spq) from the Database Wizard > using SPSS 16.0.x (or earlier). I try to open my saved ODBC query in SPSS > Statistics 17.0.x. > -or- > I have saved a text file format file (tpf) from the Text Import Wizard using > SPSS 16.0.x. I try to open text using my saved TPF file. > > I get the following error the next time I try to edit the query again: > > The query file '--File Path--' could not be opened. > The file format may be incompatible with the installed version of SPSS. > > How can I fix this? > > > Resolution Subject: This problem has been reported to SPSS Development - No > Workaround Available > > Resolution Description: > Unfortunately, the code for these two functions needed to be completely > rewritten in SPSS Statistics 17.0. Due to this fact, SPSS Statistics 17.0.x > will not be able to read TPF and SPQ files created from SPSS 16 or earlier > versions. Please recreate your queries or predefined formats in SPSS 17.0. > This allows for saved queries from SPSS 17 Statistics to be opened in > subsequent releases when they occur. We apologize for the inconvenience. > > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of > Khaneja, Gurvinder > Sent: Monday, November 17, 2008 9:49 AM > To: [hidden email] > Subject: Re: Using SPSS Import Wizard to read text data > > Hi all, > I have started using SPSS version 17 and as routine, when I tried to read in > data from text file using the Text Import wizard (using my saved *.tpf file), > it does not go beyond step 4 . Step 5 shows a blank screen. I tried going > back to SPSS version 16 and it works. > > Am I missing something or is there a bug in the new software? Please advice. > G. Khaneja > > ===================== > 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 Professor Diana Kornbrot School of Psychology University of Hertfordshire College Lane, Hatfield, Hertfordshire AL10 9AB, UK email: [hidden email] web: http://web.mac.com/kornbrot/iweb/KornbrotHome.html voice: +44 (0) 170 728 4626 fax: +44 (0) 170 728 5073 Home 19 Elmhurst Avenue London N2 0LT, UK voice: +44 (0) 208 883 3657 mobile: +44 (0) 796 890 2102 fax: +44 (0) 870 706 4997 ====================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 |
|
Your comments are open to some interpretation. So here's some clarification based on behavior of release 17:
Spaces and special characters are not allowed in variable names, but when reading Excel files, legal variable names are automatically created by removing the characters that are not allowed, and the full column heading is used as the variable label. Variable names are not case-sensitive, but they are case-preserving. So a column heading in Excel such as "Customer Name" is converted to the variable CustomerName with the label "Customer Name". In syntax, the variable can be referenced without regard to case, but the display in output and in the Data Editor should reflect the correct case. AFAIK, there is no problem with strings that start with numbers, even with data read from Excel. Keep in mind, however, that an Excel file can mix many different data types in the same column, while each variable in SPSS can have only one data type. So the code that reads Excel files has to make some decisions on what data type to assign to each variable. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of kornbrot Sent: Monday, November 17, 2008 12:43 PM To: [hidden email] Subject: Re: Using SPSS Import Wizard to read text data A general rule about SPSS 1. The newer the version the worse the import facilities 16 on the mac is absolutely dire, will not correctly import from .xslx for m any files, as it makes weird incorrect guesses Slightly better with .xls, BUT STILL can¹t parse space in a variable name STILL can¹t use upper & lower case, or special characters in variable names STILL can¹t have string use string variable data starting with a number All the above are VERY easy to fix by a competent programmer, about 2 days work All fixed in versions of JMP & other user friendly programmes at least a decade ago. 2. The newer the version the worse the interface to the graph functions, and the fewer the options Please keep legacy graphs much quicker and more flexible One just fills in x, & y axes and categroical grouoing factors for colour and pattern Also dialogues no longer permit changes to line width All that programming effort waste on making life difficult for ysuers as they slowly drag variables to axes. I¹d really like a response from SPSS themselves on all this SPSS is to be congratulated on improved computational functionality Why is interface so appalling and getting WORSE Why are so many useful graph tailoring functions disappearing from dialogue interface? SPSS please answer Best Diana On 17/11/2008 17:55, "SPSS Support" <[hidden email]> wrote: > Hello, > If the .tpf was saved from an earlier SPSS version, then you will need to > recreate the format in SPSS 17. As noted in the resolution which I've pasted > below (from http://support.spss.com ), the code for creating tpf and sql files > was changed extensively in SPSS 17. > > David Matheson > SPSS Statistical Support > **************************** > > Resolution number: 79341 Created on: Aug 26 2008 Last Reviewed on: Sep 22 > 2008 > > Problem Subject: Saved tpf or spq files cannot be opened with later versions > of SPSS Statistics. > > Problem Description: I have saved a query (spq) from the Database Wizard > using SPSS 16.0.x (or earlier). I try to open my saved ODBC query in SPSS > Statistics 17.0.x. > -or- > I have saved a text file format file (tpf) from the Text Import Wizard using > SPSS 16.0.x. I try to open text using my saved TPF file. > > I get the following error the next time I try to edit the query again: > > The query file '--File Path--' could not be opened. > The file format may be incompatible with the installed version of SPSS. > > How can I fix this? > > > Resolution Subject: This problem has been reported to SPSS Development - No > Workaround Available > > Resolution Description: > Unfortunately, the code for these two functions needed to be completely > rewritten in SPSS Statistics 17.0. Due to this fact, SPSS Statistics 17.0.x > will not be able to read TPF and SPQ files created from SPSS 16 or earlier > versions. Please recreate your queries or predefined formats in SPSS 17.0. > This allows for saved queries from SPSS 17 Statistics to be opened in > subsequent releases when they occur. We apologize for the inconvenience. > > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of > Khaneja, Gurvinder > Sent: Monday, November 17, 2008 9:49 AM > To: [hidden email] > Subject: Re: Using SPSS Import Wizard to read text data > > Hi all, > I have started using SPSS version 17 and as routine, when I tried to read in > data from text file using the Text Import wizard (using my saved *.tpf file), > it does not go beyond step 4 . Step 5 shows a blank screen. I tried going > back to SPSS version 16 and it works. > > Am I missing something or is there a bug in the new software? Please advice. > G. Khaneja > > ===================== > 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 Professor Diana Kornbrot School of Psychology University of Hertfordshire College Lane, Hatfield, Hertfordshire AL10 9AB, UK email: [hidden email] web: http://web.mac.com/kornbrot/iweb/KornbrotHome.html voice: +44 (0) 170 728 4626 fax: +44 (0) 170 728 5073 Home 19 Elmhurst Avenue London N2 0LT, UK voice: +44 (0) 208 883 3657 mobile: +44 (0) 796 890 2102 fax: +44 (0) 870 706 4997 ======= 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 |
|
In reply to this post by Khaneja, Gurvinder
Diana, please see my comments below in-line.
Please keep in mind about the balance we have to make between the requirements of the customer base at large and the requirements of a few. In order to try to help more users get SPSS Statistics to do what they specifically require, we have opened the product to broad customization and extension by users with features such as the Programmability Extension, Graphboard, and the Custom Dialog Builder (the latter two are new v17). In scaling back development in one area, another will invariably be felt by some to be underdeveloped. We have an extensive advisory board of customers and beta program to help us get the most feedback possible to help us make the best decision possible with regards to the areas in which we commit resources. I would like to extend to you the offer to beta test future versions of SPSS Statistics. If you are interested, please let me know. Regards. Kyle Weeks, Ph.D. Director of Product Strategy, SPSS Statistics SPSS Inc. [hidden email] www.spss.com SPSS Inc. helps organizations turn data into insight through predictive analytics. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of kornbrot Sent: Monday, November 17, 2008 12:43 PM To: [hidden email] Subject: Re: Using SPSS Import Wizard to read text data A general rule about SPSS 1. The newer the version the worse the import facilities 16 on the mac is absolutely dire, will not correctly import from .xslx for m any files, as it makes weird incorrect guesses [Weeks, Kyle] version 16 was the first version to be able to read .xslx files. If you have specific examples of incorrect imports please send them to [hidden email] so they can be filed and tracked. Slightly better with .xls, BUT STILL can¹t parse space in a variable name STILL can¹t use upper & lower case, or special characters in variable names STILL can¹t have string use string variable data starting with a number All the above are VERY easy to fix by a competent programmer, about 2 days Work [Weeks, Kyle] I am afraid that you are vastly underestimating the amount of work required for these features. I see that in other posting that Rick Oliver has explained some of the logic involved. All fixed in versions of JMP & other user friendly programmes at least a decade ago. 2. The newer the version the worse the interface to the graph functions, and the fewer the options Please keep legacy graphs much quicker and more flexible One just fills in x, & y axes and categroical grouoing factors for colour and pattern Also dialogues no longer permit changes to line width All that programming effort waste on making life difficult for ysuers as they slowly drag variables to axes. I¹d really like a response from SPSS themselves on all this SPSS is to be congratulated on improved computational functionality Why is interface so appalling and getting WORSE Why are so many useful graph tailoring functions disappearing from dialogue interface? [Weeks, Kyle] I need some more details on the issues you mention. Are you referring to the old interactive graphics (IGRAPH) editor? The IGRAPH editor was replaced in v16 with the Chart Editor that is used in the other graphics systems. The old IGRAPH editor was based on outdated technology that could no longer be maintained. Consolidating technology allows us to do things like release a Mac version on a regular basis going forward. SPSS please answer Best Diana On 17/11/2008 17:55, "SPSS Support" <[hidden email]> wrote: > Hello, > If the .tpf was saved from an earlier SPSS version, then you will need to > recreate the format in SPSS 17. As noted in the resolution which I've pasted > below (from http://support.spss.com ), the code for creating tpf and sql files > was changed extensively in SPSS 17. > > David Matheson > SPSS Statistical Support > **************************** > > Resolution number: 79341 Created on: Aug 26 2008 Last Reviewed on: Sep 22 > 2008 > > Problem Subject: Saved tpf or spq files cannot be opened with later versions > of SPSS Statistics. > > Problem Description: I have saved a query (spq) from the Database Wizard > using SPSS 16.0.x (or earlier). I try to open my saved ODBC query in SPSS > Statistics 17.0.x. > -or- > I have saved a text file format file (tpf) from the Text Import Wizard using > SPSS 16.0.x. I try to open text using my saved TPF file. > > I get the following error the next time I try to edit the query again: > > The query file '--File Path--' could not be opened. > The file format may be incompatible with the installed version of SPSS. > > How can I fix this? > > > Resolution Subject: This problem has been reported to SPSS Development - No > Workaround Available > > Resolution Description: > Unfortunately, the code for these two functions needed to be completely > rewritten in SPSS Statistics 17.0. Due to this fact, SPSS Statistics 17.0.x > will not be able to read TPF and SPQ files created from SPSS 16 or earlier > versions. Please recreate your queries or predefined formats in SPSS 17.0. > This allows for saved queries from SPSS 17 Statistics to be opened in > subsequent releases when they occur. We apologize for the inconvenience. > > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of > Khaneja, Gurvinder > Sent: Monday, November 17, 2008 9:49 AM > To: [hidden email] > Subject: Re: Using SPSS Import Wizard to read text data > > Hi all, > I have started using SPSS version 17 and as routine, when I tried to read in > data from text file using the Text Import wizard (using my saved *.tpf file), > it does not go beyond step 4 . Step 5 shows a blank screen. I tried going > back to SPSS version 16 and it works. > > Am I missing something or is there a bug in the new software? Please advice. > G. Khaneja > > ===================== > 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 Professor Diana Kornbrot School of Psychology University of Hertfordshire College Lane, Hatfield, Hertfordshire AL10 9AB, UK email: [hidden email] web: http://web.mac.com/kornbrot/iweb/KornbrotHome.html voice: +44 (0) 170 728 4626 fax: +44 (0) 170 728 5073 Home 19 Elmhurst Avenue London N2 0LT, UK voice: +44 (0) 208 883 3657 mobile: +44 (0) 796 890 2102 fax: +44 (0) 870 706 4997 ======= 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 |
|
On the specific issues of spaces and special characters in variable names:
First, as I already mentioned in a previous post, while SPSS doesn't allow spaces or special characters in variable names, it automatically creates legal variable names and preserves the original name as a label when reading many external data sources, such as Excel and various database sources. Second, while it might be theoretically possible to change variable naming rules to accomondate spaces and special characters, this would have far reaching implications, not the least of which would be compromising/breaking existing command syntax jobs that many users rely on. For example, the command language is designed to be user-friendly in many regards, including specifying variable lists, in which either spaces or commas can be interpreted as delimiters. So there is no ambiguity when parsing something like: frequencies variables=var1 var2. If you allowed spaces in variable names, how would the above syntax be parsed unambiguously? It might be two separate variables or one variable named "var1 var2". We could impose a rule that the only valid delimiter is a comma, but that would break many existing jobs. In a similar vein, let's say we allowed special characters, such as a dash, in variable names. Now consider the following command syntax: compute var3=var2-var1. Is "var2-var1" an arithmetic expression or a variable name? I think you might find that many programming languages have similar restrictions on variable naming conventions. Stata and SAS variable name restrictions, for example, are remarkably similar to SPSS variable name restrictions. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Weeks, Kyle Sent: Monday, November 17, 2008 4:26 PM To: [hidden email] Subject: FW: Re: Using SPSS Import Wizard to read text data Diana, please see my comments below in-line. Please keep in mind about the balance we have to make between the requirements of the customer base at large and the requirements of a few. In order to try to help more users get SPSS Statistics to do what they specifically require, we have opened the product to broad customization and extension by users with features such as the Programmability Extension, Graphboard, and the Custom Dialog Builder (the latter two are new v17). In scaling back development in one area, another will invariably be felt by some to be underdeveloped. We have an extensive advisory board of customers and beta program to help us get the most feedback possible to help us make the best decision possible with regards to the areas in which we commit resources. I would like to extend to you the offer to beta test future versions of SPSS Statistics. If you are interested, please let me know. Regards. Kyle Weeks, Ph.D. Director of Product Strategy, SPSS Statistics SPSS Inc. [hidden email] www.spss.com SPSS Inc. helps organizations turn data into insight through predictive analytics. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of kornbrot Sent: Monday, November 17, 2008 12:43 PM To: [hidden email] Subject: Re: Using SPSS Import Wizard to read text data A general rule about SPSS 1. The newer the version the worse the import facilities 16 on the mac is absolutely dire, will not correctly import from .xslx for m any files, as it makes weird incorrect guesses [Weeks, Kyle] version 16 was the first version to be able to read .xslx files. If you have specific examples of incorrect imports please send them to [hidden email] so they can be filed and tracked. Slightly better with .xls, BUT STILL can¹t parse space in a variable name STILL can¹t use upper & lower case, or special characters in variable names STILL can¹t have string use string variable data starting with a number All the above are VERY easy to fix by a competent programmer, about 2 days Work [Weeks, Kyle] I am afraid that you are vastly underestimating the amount of work required for these features. I see that in other posting that Rick Oliver has explained some of the logic involved. All fixed in versions of JMP & other user friendly programmes at least a decade ago. 2. The newer the version the worse the interface to the graph functions, and the fewer the options Please keep legacy graphs much quicker and more flexible One just fills in x, & y axes and categroical grouoing factors for colour and pattern Also dialogues no longer permit changes to line width All that programming effort waste on making life difficult for ysuers as they slowly drag variables to axes. I¹d really like a response from SPSS themselves on all this SPSS is to be congratulated on improved computational functionality Why is interface so appalling and getting WORSE Why are so many useful graph tailoring functions disappearing from dialogue interface? [Weeks, Kyle] I need some more details on the issues you mention. Are you referring to the old interactive graphics (IGRAPH) editor? The IGRAPH editor was replaced in v16 with the Chart Editor that is used in the other graphics systems. The old IGRAPH editor was based on outdated technology that could no longer be maintained. Consolidating technology allows us to do things like release a Mac version on a regular basis going forward. SPSS please answer Best Diana On 17/11/2008 17:55, "SPSS Support" <[hidden email]> wrote: > Hello, > If the .tpf was saved from an earlier SPSS version, then you will need to > recreate the format in SPSS 17. As noted in the resolution which I've pasted > below (from http://support.spss.com ), the code for creating tpf and sql files > was changed extensively in SPSS 17. > > David Matheson > SPSS Statistical Support > **************************** > > Resolution number: 79341 Created on: Aug 26 2008 Last Reviewed on: Sep 22 > 2008 > > Problem Subject: Saved tpf or spq files cannot be opened with later versions > of SPSS Statistics. > > Problem Description: I have saved a query (spq) from the Database Wizard > using SPSS 16.0.x (or earlier). I try to open my saved ODBC query in SPSS > Statistics 17.0.x. > -or- > I have saved a text file format file (tpf) from the Text Import Wizard using > SPSS 16.0.x. I try to open text using my saved TPF file. > > I get the following error the next time I try to edit the query again: > > The query file '--File Path--' could not be opened. > The file format may be incompatible with the installed version of SPSS. > > How can I fix this? > > > Resolution Subject: This problem has been reported to SPSS Development - No > Workaround Available > > Resolution Description: > Unfortunately, the code for these two functions needed to be completely > rewritten in SPSS Statistics 17.0. Due to this fact, SPSS Statistics 17.0.x > will not be able to read TPF and SPQ files created from SPSS 16 or earlier > versions. Please recreate your queries or predefined formats in SPSS 17.0. > This allows for saved queries from SPSS 17 Statistics to be opened in > subsequent releases when they occur. We apologize for the inconvenience. > > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of > Khaneja, Gurvinder > Sent: Monday, November 17, 2008 9:49 AM > To: [hidden email] > Subject: Re: Using SPSS Import Wizard to read text data > > Hi all, > I have started using SPSS version 17 and as routine, when I tried to read in > data from text file using the Text Import wizard (using my saved *.tpf file), > it does not go beyond step 4 . Step 5 shows a blank screen. I tried going > back to SPSS version 16 and it works. > > Am I missing something or is there a bug in the new software? Please advice. > G. Khaneja > > ===================== > 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 Professor Diana Kornbrot School of Psychology University of Hertfordshire College Lane, Hatfield, Hertfordshire AL10 9AB, UK email: [hidden email] web: http://web.mac.com/kornbrot/iweb/KornbrotHome.html voice: +44 (0) 170 728 4626 fax: +44 (0) 170 728 5073 Home 19 Elmhurst Avenue London N2 0LT, UK voice: +44 (0) 208 883 3657 mobile: +44 (0) 796 890 2102 fax: +44 (0) 870 706 4997 ======= 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 ===================== 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 |
|
In reply to this post by Weeks, Kyle
Kyle,
I don't doubt the sincerity and helpfulness of you and other SPSS staff who contribute to the discussion in this listserv forum, and who provide very useful advice on SPSS application and support. However, I find myself somewhat in agreement with Diana Kornbrot's take on the evolution or devolution of features in SPSS. I've seen SPSS graph output go from a fully editable object based output (in V. 6, I think?), to graphs that are only partially editable or not at all in Adobe Illustrator (V. 11; every single character a separate Powerpoint drawing object?!!) to the current output (bitmap graphs? Did I fall asleep and wake up in 1980 or something?). Version 16 won't copy/paste to older versions of Excel or ANY version of Illustrator and won't import from a file path that includes special characters. And nearly a year on, there are no fixes for these in V. 16. I haven't had a chance to try V. 17 yet, but V. 16 is basically unusable for me. I have to keep an old machine going just so I can get work done in V.11 mac. V. 11 of course won't run in current OS 10.5. Hoping for improvements, Ian Martin Ian D. Martin, Ph.D. Tsuji Laboratory University of Waterloo Dept. of Environment & Resource Studies On 17 Nov, 2008, at 5:26 PM, Weeks, Kyle wrote: > Diana, please see my comments below in-line. > > Please keep in mind about the balance we have to make between the > requirements of the customer base at large and the requirements of > a few. In order to try to help more users get SPSS Statistics to do > what they specifically require, we have opened the product to broad > customization and extension by users with features such as the > Programmability Extension, Graphboard, and the Custom Dialog > Builder (the latter two are new v17). In scaling back development > in one area, another will invariably be felt by some to be > underdeveloped. We have an extensive advisory board of customers > and beta program to help us get the most feedback possible to help > us make the best decision possible with regards to the areas in > which we commit resources. > > I would like to extend to you the offer to beta test future > versions of SPSS Statistics. If you are interested, please let me > know. > > Regards. > > Kyle Weeks, Ph.D. > Director of Product Strategy, SPSS Statistics > SPSS Inc. > [hidden email] > www.spss.com > SPSS Inc. helps organizations turn data into insight through > predictive analytics. > > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] On > Behalf Of kornbrot > Sent: Monday, November 17, 2008 12:43 PM > To: [hidden email] > Subject: Re: Using SPSS Import Wizard to read text data > > A general rule about SPSS > 1. The newer the version the worse the import facilities > 16 on the mac is absolutely dire, will not correctly import > from .xslx for m > any files, as it makes weird incorrect guesses > > [Weeks, Kyle] version 16 was the first version to be able to > read .xslx files. If you have specific examples of incorrect > imports please send them to [hidden email] so they can be filed > and tracked. > Slightly better with .xls, BUT > STILL can¹t parse space in a variable name > STILL can¹t use upper & lower case, or special characters in > variable names > STILL can¹t have string use string variable data starting with a > number > All the above are VERY easy to fix by a competent programmer, about > 2 days > Work > > [Weeks, Kyle] I am afraid that you are vastly underestimating the > amount of work required for these features. I see that in other > posting that Rick Oliver has explained some of the logic involved. > > All fixed in versions of JMP & other user friendly programmes at > least a > decade ago. > 2. The newer the version the worse the interface to the graph > functions, > and the fewer the options > Please keep legacy graphs much quicker and more flexible > One just fills in x, & y axes and categroical grouoing factors for > colour > and pattern > Also dialogues no longer permit changes to line width > All that programming effort waste on making life difficult for > ysuers as > they slowly drag variables to axes. > > I¹d really like a response from SPSS themselves on all this > SPSS is to be congratulated on improved computational functionality > Why is interface so appalling and getting WORSE > Why are so many useful graph tailoring functions disappearing from > dialogue > interface? > > > [Weeks, Kyle] I need some more details on the issues you mention. > Are you referring to the old interactive graphics (IGRAPH) editor? > The IGRAPH editor was replaced in v16 with the Chart Editor that is > used in the other graphics systems. The old IGRAPH editor was > based on outdated technology that could no longer be maintained. > Consolidating technology allows us to do things like release a Mac > version on a regular basis going forward. > SPSS please answer > Best > > Diana > > > On 17/11/2008 17:55, "SPSS Support" <[hidden email]> wrote: > >> Hello, >> If the .tpf was saved from an earlier SPSS version, then you >> will need to >> recreate the format in SPSS 17. As noted in the resolution which >> I've pasted >> below (from http://support.spss.com ), the code for creating tpf >> and sql files >> was changed extensively in SPSS 17. >> >> David Matheson >> SPSS Statistical Support >> **************************** >> >> Resolution number: 79341 Created on: Aug 26 2008 Last Reviewed >> on: Sep 22 >> 2008 >> >> Problem Subject: Saved tpf or spq files cannot be opened with >> later versions >> of SPSS Statistics. >> >> Problem Description: I have saved a query (spq) from the Database >> Wizard >> using SPSS 16.0.x (or earlier). I try to open my saved ODBC query >> in SPSS >> Statistics 17.0.x. >> -or- >> I have saved a text file format file (tpf) from the Text Import >> Wizard using >> SPSS 16.0.x. I try to open text using my saved TPF file. >> >> I get the following error the next time I try to edit the query >> again: >> >> The query file '--File Path--' could not be opened. >> The file format may be incompatible with the installed version of >> SPSS. >> >> How can I fix this? >> >> >> Resolution Subject: This problem has been reported to SPSS >> Development - No >> Workaround Available >> >> Resolution Description: >> Unfortunately, the code for these two functions needed to be >> completely >> rewritten in SPSS Statistics 17.0. Due to this fact, SPSS >> Statistics 17.0.x >> will not be able to read TPF and SPQ files created from SPSS 16 or >> earlier >> versions. Please recreate your queries or predefined formats in >> SPSS 17.0. >> This allows for saved queries from SPSS 17 Statistics to be opened in >> subsequent releases when they occur. We apologize for the >> inconvenience. >> >> >> -----Original Message----- >> From: SPSSX(r) Discussion [mailto:[hidden email]] On >> Behalf Of >> Khaneja, Gurvinder >> Sent: Monday, November 17, 2008 9:49 AM >> To: [hidden email] >> Subject: Re: Using SPSS Import Wizard to read text data >> >> Hi all, >> I have started using SPSS version 17 and as routine, when I tried >> to read in >> data from text file using the Text Import wizard (using my saved >> *.tpf file), >> it does not go beyond step 4 . Step 5 shows a blank screen. I >> tried going >> back to SPSS version 16 and it works. >> >> Am I missing something or is there a bug in the new software? >> Please advice. >> G. Khaneja >> >> ===================== >> 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 > > Professor Diana Kornbrot > School of Psychology > University of Hertfordshire > College Lane, Hatfield, Hertfordshire AL10 9AB, UK > > email: [hidden email] > web: http://web.mac.com/kornbrot/iweb/KornbrotHome.html > voice: +44 (0) 170 728 4626 > fax: +44 (0) 170 728 5073 > Home > 19 Elmhurst Avenue > London N2 0LT, UK > > voice: +44 (0) 208 883 3657 > mobile: +44 (0) 796 890 2102 > fax: +44 (0) 870 706 4997 > > ======= > 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 ===================== 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 |
