Writing Simple Syntax from provided information

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Writing Simple Syntax from provided information

Danielle
CARS93T.TXT
CARS93T.SPS

Cars were selected at random from among 1993 passenger car models.
Information about this data is stored in CARS93T.SPS
Corresponding data is in CARS93T.TXT

Using the information in these files I want to create a syntax containing only the 4 variables.
Type, Minimum Price, Drive and Manual Transmission.
Want to include where appropriate the VARIABLE and VALUE LABELS but NOT MISSING VALUES.
Include Title called "Cars 1993"
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

David Marso
Administrator
Looks like a homework assignment.
Get at it!
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

Danielle
Quiet Correct

Some assistance would be helpful though?
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

David Marso
Administrator
Well, there is the DATA LIST and GET DATA commands which are good for reading text data.
VALUE LABELS and VARIABLE LABELS commands, and MISSING VALUES command for defining the metadata.
What specifics do you find mystifying?
If you want somebody to do this for you then you are in the wrong forum.
If you have a specific question then many people are here to help.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

John F Hall
Check out section Block  1: From questionnaire to SPSS saved file
http://surveyresearch.weebly.com/block-1-from-questionnaire-to-spss-saved-fi
le.html
Home or not, you still have to learn how to do it: this will show you how.

For DAT LIST, you have to count the cells carefully and cars.txt would be
easier to read if the make of car was at the end of the same line.  

Copy/paste should be pretty easy to generate the *.sps file, but you have to
work which bits you need


John F Hall (Mr)
[Retired academic survey researcher]

Email:   [hidden email]  
Website: www.surveyresearch.weebly.com  
SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
David Marso
Sent: 13 April 2015 07:00
To: [hidden email]
Subject: Re: Writing Simple Syntax from provided information

Well, there is the DATA LIST and GET DATA commands which are good for
reading text data.
VALUE LABELS and VARIABLE LABELS commands, and MISSING VALUES command for
defining the metadata.
What specifics do you find mystifying?
If you want somebody to *do this for you *then you are in the wrong forum.
If you have a specific question then many people are here to help.



-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email
me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos
ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in
abyssum?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Writing-Simple-Syntax-from-pro
vided-information-tp5729206p5729209.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command SIGNOFF SPSSX-L For a list of
commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

Danielle
In reply to this post by David Marso
My Specific question is the syntax required to pull the variables
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

David Marso
Administrator
I referenced the DATA LIST and GET DATA commands in my post.
Look it up in the help and attempt to apply what you read.
If you get stuck, post your efforts and that will probably get you more specific help.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

Art Kendall
In reply to this post by David Marso
Open a syntax window.

for each of the upper case word/phrases in David's post there are two ways to see the documentation
(1) use the <f1> key aka the <help key>
(a) type it into a syntax window on a new line.
(b) put a period after it.
(c) place your cursor on it
(d) hit the <f1> key

(2) use the help functions
(a) click the <help> tab
(b) click <topics>
(c) type the word/phrase into the edit box.

As a beginner you would do well to brefly browse each of the entries under <help>.

The tutorials, case studies, and statistics coach will make you life easier and help you gain fluency ins using SPSS.
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

mils
I've created the following syntax, but SPSS understands second line as another line and it should be still the first line.

data list list
 /brand (a10) model (a10)  size (a10) var1 var2 var3 var4 var5  var6 var7 var8 var9 var10 var11 var12 var13 var14  var15  var16  var17  var18  var19  var20  var21 var22 var23 .
begin data.
Acura         Integra        Small   12.9 15.9 18.8 25 31 0 1 4 1.8 140 6300
2890 1 13.2 5 177 102 68 37 26.5 11 2705 0
Acura         Legend         Midsize 29.2 33.9 38.7 18 25 2 1 6 3.2 200 5500
2335 1 18.0 5 195 115 71 38 30.0 15 3560 0
end data.

How can I tell SPSS to read the first and the second as one single line?

Thanks,
mils
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

David Marso
Administrator
Please look at the documentation for DATA LIST command.
What option other than DATA LIST LIST appears?
Hint:Braveheart!
mils wrote
I've created the following syntax, but SPSS understands second line as another line and it should be still the first line.

data list list
 /brand (a10) model (a10)  size (a10) var1 var2 var3 var4 var5  var6 var7 var8 var9 var10 var11 var12 var13 var14  var15  var16  var17  var18  var19  var20  var21 var22 var23 .
begin data.
Acura         Integra        Small   12.9 15.9 18.8 25 31 0 1 4 1.8 140 6300
2890 1 13.2 5 177 102 68 37 26.5 11 2705 0
Acura         Legend         Midsize 29.2 33.9 38.7 18 25 2 1 6 3.2 200 5500
2335 1 18.0 5 195 115 71 38 30.0 15 3560 0
end data.

How can I tell SPSS to read the first and the second as one single line?

Thanks,
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

mils
Nice hint!
Thanks David!!

data list free
 /brand (a10) model (a10)  size (a10) var1 var2 var3 var4 var5  var6 var7 var8 var9 var10 var11 var12 var13 var14  var15  var16  var17  var18  var19  var20  var21 var22 var23 .
begin data.
Acura         Integra        Small   12.9 15.9 18.8 25 31 0 1 4 1.8 140 6300
2890 1 13.2 5 177 102 68 37 26.5 11 2705 0
Acura         Legend         Midsize 29.2 33.9 38.7 18 25 2 1 6 3.2 200 5500
2335 1 18.0 5 195 115 71 38 30.0 15 3560 0
end data.
mils
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

John F Hall
In reply to this post by mils
You need to edit cart.txt to get rid of the carriage return at the end of
alternate 1st 3rd 5th etc lines.

SPSS thinks the 2nd, 4th and 6th etc lines are separate cases.

It's always a good idea to give each case a serial number: here the easiest
method is to use the case number from the SPSS Data Editor in Variable View.


So:

data list list
 /brand (a10) model (a10)  size (a10) var1 var2 var3 var4 var5  var6 var7
var8 var9 var10 var11 var12 var13 var14  var15  var16  var17  var18  var19
var20  var21 var22 var23 .
begin data.
Acura         Integra        Small   12.9 15.9 18.8 25 31 0 1 4 1.8 140 6300
2890 1 13.2 5 177 102 68 37 26.5 11 2705 0
Acura         Legend        Midsize 29.2 33.9 38.7 18 25 2 1 6 3.2 200 5500
2335 1 18.0 5 195 115 71 38 30.0 15 3560 0
end data.
compute serial = $casenum.
execute.
list serial, brand, var23 /cases 2.

You also need to get rid of superfluous decimal places in integer codes.

Check out FORMATS in the manual.

formats serial (f3.0) var4 var5 (f2.0).
list serial, brand to var5 /cases 2.

This syntax gives:

serial brand      model      size           var1     var2     var3 var4 var5

 
    1  Acura      Integra    Small         12.90    15.90    18.80  25   31
    2  Acura      Legend     Midsize       29.20    33.90    38.70  18   25
 
 
Number of cases read:  2    Number of cases listed:  2


You should be able to do the rest yourself, including adding variable and
value labels.

Hope this helps

John F Hall (Mr)
[Retired academic survey researcher]

Email:   [hidden email]  
Website: www.surveyresearch.weebly.com  
SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
mils
Sent: 14 April 2015 11:14
To: [hidden email]
Subject: Re: Writing Simple Syntax from provided information

I've created the following syntax, but SPSS understands second line as
another line and it should be still the first line.

data list list
 /brand (a10) model (a10)  size (a10) var1 var2 var3 var4 var5  var6 var7
var8 var9 var10 var11 var12 var13 var14  var15  var16  var17  var18  var19
var20  var21 var22 var23 .
begin data.
Acura         Integra        Small   12.9 15.9 18.8 25 31 0 1 4 1.8 140 6300
2890 1 13.2 5 177 102 68 37 26.5 11 2705 0
Acura         Legend         Midsize 29.2 33.9 38.7 18 25 2 1 6 3.2 200 5500
2335 1 18.0 5 195 115 71 38 30.0 15 3560 0 end data.

How can I tell SPSS to read the first and the second as one single line?

Thanks,



-----
mils
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Writing-Simple-Syntax-from-pro
vided-information-tp5729206p5729223.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command SIGNOFF SPSSX-L For a list of
commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

David Marso
Administrator
FREE your mind John ;-)
--
John F Hall wrote
You need to edit cart.txt to get rid of the carriage return at the end of
alternate 1st 3rd 5th etc lines.

SPSS thinks the 2nd, 4th and 6th etc lines are separate cases.

It's always a good idea to give each case a serial number: here the easiest
method is to use the case number from the SPSS Data Editor in Variable View.


So:

data list list
 /brand (a10) model (a10)  size (a10) var1 var2 var3 var4 var5  var6 var7
var8 var9 var10 var11 var12 var13 var14  var15  var16  var17  var18  var19
var20  var21 var22 var23 .
begin data.
Acura         Integra        Small   12.9 15.9 18.8 25 31 0 1 4 1.8 140 6300
2890 1 13.2 5 177 102 68 37 26.5 11 2705 0
Acura         Legend        Midsize 29.2 33.9 38.7 18 25 2 1 6 3.2 200 5500
2335 1 18.0 5 195 115 71 38 30.0 15 3560 0
end data.
compute serial = $casenum.
execute.
list serial, brand, var23 /cases 2.

You also need to get rid of superfluous decimal places in integer codes.

Check out FORMATS in the manual.

formats serial (f3.0) var4 var5 (f2.0).
list serial, brand to var5 /cases 2.

This syntax gives:

serial brand      model      size           var1     var2     var3 var4 var5

 
    1  Acura      Integra    Small         12.90    15.90    18.80  25   31
    2  Acura      Legend     Midsize       29.20    33.90    38.70  18   25
 
 
Number of cases read:  2    Number of cases listed:  2


You should be able to do the rest yourself, including adding variable and
value labels.

Hope this helps

John F Hall (Mr)
[Retired academic survey researcher]

Email:   [hidden email]   
Website: www.surveyresearch.weebly.com  
SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
mils
Sent: 14 April 2015 11:14
To: [hidden email]
Subject: Re: Writing Simple Syntax from provided information

I've created the following syntax, but SPSS understands second line as
another line and it should be still the first line.

data list list
 /brand (a10) model (a10)  size (a10) var1 var2 var3 var4 var5  var6 var7
var8 var9 var10 var11 var12 var13 var14  var15  var16  var17  var18  var19
var20  var21 var22 var23 .
begin data.
Acura         Integra        Small   12.9 15.9 18.8 25 31 0 1 4 1.8 140 6300
2890 1 13.2 5 177 102 68 37 26.5 11 2705 0
Acura         Legend         Midsize 29.2 33.9 38.7 18 25 2 1 6 3.2 200 5500
2335 1 18.0 5 195 115 71 38 30.0 15 3560 0 end data.

How can I tell SPSS to read the first and the second as one single line?

Thanks,



-----
mils
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Writing-Simple-Syntax-from-pro
vided-information-tp5729206p5729223.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command SIGNOFF SPSSX-L For a list of
commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

David Marso
Administrator
Could also use /RECORDS=2 (rather than FREE) on data list if the data are properly aligned.
See the FM for details.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Writing Simple Syntax from provided information

John F Hall

Thought of that, but really pushed this morning so didn't have time to play around.  Perhaps someone should produce the data in the correct format in the first place, either as *.txt or in an Excel file?

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email]   

Website: www.surveyresearch.weebly.com  

SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop

 

 

 

 

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of David Marso
Sent: 15 April 2015 15:04
To: [hidden email]
Subject: Re: Writing Simple Syntax from provided information

 

Could also use /RECORDS=2 (rather than FREE) on data list if the data are properly aligned.

See the FM for details.

 

 

 

-----

Please reply to the list and not to my personal email.

Those desiring my consulting or training services please feel free to email me.

---

"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."

Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"

--

View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Writing-Simple-Syntax-from-provided-information-tp5729206p5729231.html

Sent from the SPSSX Discussion mailing list archive at Nabble.com.

 

=====================

To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD