Inputting data via syntax editor.

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

Inputting data via syntax editor.

statknot
If suppose, i want to input data through syntax for the following data

Age Name
23 Abc
54 Xyz
34 Pqr

One can easily do it by following syntax

data list list
/ Age * Name (A3).
begin data.
23 ABC
54 XYZ
34 PQR
End data.

In the above program, please note that the problem i have faced is that i cannot have Name as first variable.

But, if i want to have the values for Name like Name with their Surname by giving blank in between the name & surname i am unable to do data entry.

For eg.

data list list
/ Age * Name (A7).
begin data.
23 ABC abc
54 XYZ xvz
34 PQR pqr
End data.


I am really confused how to write the proper syntax to do data entry with all the variable properties specified in it. I believe, there are lots of flaws in spss syntax. Is there anyone who can render their ideas regarding the spss syntax for data entry. It would be of great help if anyone replies for the above query. Thanks in advance


Regards
Prathap. L
Reply | Threaded
Open this post in threaded view
|

Re: Inputting data via syntax editor.

Marta Garcia-Granero
Hi Prathap

09/08/2012 9:35, Prathap Maverick wrote:
If suppose, i want to input data through syntax for the following data

Age Name
23 Abc
54 Xyz
34 Pqr

One can easily do it by following syntax

data list list
/ Age * Name (A3).
begin data.
23 ABC
54 XYZ
34 PQR
End data.

In the above program, please note that the problem i have faced is that i cannot have Name as first variable.

I really DON'T understand that sentence

But, if i want to have the values for Name like Name with their Surname by giving blank in between the name & surname i am unable to do data entry.

For eg.

data list list
/ Age * Name (A7).
begin data.
23 ABC abc
54 XYZ xvz
34 PQR pqr
End data.

I tried this:

data list list
/ Age * Name (A7).
begin data.
23 "ABC abc"
54 "XYZ xvz"
34 "PQR pqr"
End data.

and it worked OK


I am really confused how to write the proper syntax to do data entry with all the variable properties specified in it. I believe, there are lots of flaws in spss syntax.
Did you try to read the manual? It helped me a lot when I was a beginner, like you now.

Regards,
Marta GG

Reply | Threaded
Open this post in threaded view
|

Re: Inputting data via syntax editor.

David Marso
Administrator
As Marta indicated you can quote the strings.
Alternatively  you can specify a delimiter (or set of delimiters).

data list list (tab) / v1 (A3) name (A20) more (f5).
begin data
abc first last 12346
def xxxxx qwwwe 78901
end data.
list.

Those are

tabs

separating the abc from first last and 12346 etc


V1  NAME                  MORE

abc first last           12346
def xxxxx qwwwe          78901

From the FM

"Freefield Data

FREE can read freefield data with multiple cases recorded on one record or with one case recorded
on more than one record. LIST can read freefield data with one case on each record.
Line endings are read as delimiters between values.
If you use FORTRAN-like format specifications (for example, DOLLAR12.2), width and
decimal specifications are not used to read the data but are assigned as print and write
formats for the variable.
For freefield data without explicitly specified value delimiters:
Commas and blanks are interpreted as delimiters between values.
Extra blanks are ignored.
 Multiple commas with or without blank space between them can be used to specify missing
data.
 If a valid value contains commas or blank spaces, enclose the values in quotes.
********For data with explicitly specified value delimiters (for example, DATA LIST FREE (",")):
 Multiple delimiters without any intervening space can be used to specify missing data.
 The specified delimiters cannot occur within a data value, even if you enclose the value
in quotes.

Note: Freefield format with specified value delimiters is typically used to read data in text format
written by a computer program, not for data manually entered in a text editor."...


Number of cases read:  2    Number of cases listed:  2
Marta García-Granero-2 wrote
Hi Prathap

09/08/2012 9:35, Prathap Maverick wrote:
> If suppose, i want to input data through syntax for the following data
>
> *Age Name*
> 23 Abc
> 54 Xyz
> 34 Pqr
>
> One can easily do it by following syntax
>
> data list list
> / Age * Name (A3).
> begin data.
> 23 ABC
> 54 XYZ
> 34 PQR
> End data.
>
> In the above program, please note that the problem i have faced is
> that i cannot have *Name* as first variable.

I really DON'T understand that sentence
>
> But, if i want to have the values for *Name* like Name with their
> Surname by giving blank in between the name & surname i am unable to
> do data entry.
>
> For eg.
>
> data list list
> / Age * Name (A7).
> begin data.
> 23 ABC abc
> 54 XYZ xvz
> 34 PQR pqr
> End data.

I tried this:

data list list
/ Age * Name (A7).
begin data.
23 "ABC abc"
54 "XYZ xvz"
34 "PQR pqr"
End data.

and it worked OK
>
>
> I am really confused how to write the proper syntax to do data entry
> with all the variable properties specified in it. I believe, there are
> lots of flaws in spss syntax.
Did you try to read the manual? It helped me a lot when I was a
beginner, like you now.

Regards,
Marta GG
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: Inputting data via syntax editor.

David Marso
Administrator
In reply to this post by statknot
"I believe, there are lots of flaws in spss syntax"
The flaw is people believing RTFM is somehow not applicable to their own situation!
statknot wrote
<SNIP>

I am really confused how to write the proper syntax to do data entry with
all the variable properties specified in it. I believe, there are lots of
flaws in spss syntax. Is there anyone who can render their ideas regarding
the spss syntax for data entry. It would be of great help if anyone replies
for the above query. Thanks in advance


Regards
Prathap. L
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: Inputting data via syntax editor.

Rick Oliver-3
In reply to this post by Marta Garcia-Granero
If the string contains blanks then you either need to quote the string values or explicitly specify a a non-space delimiter, as in:

data list list (",") /Age (f3) Name (a7).

By default, both commas and spaces are interpreted as value delimiters. The above example tells the application to only use commas as delimiters.


Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]
Phone: 312.893.4922 | T/L: 206-4922




From:        Marta García-Granero <[hidden email]>
To:        [hidden email],
Date:        08/09/2012 02:56 AM
Subject:        Re: Inputting data via syntax editor.
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi Prathap

09/08/2012 9:35, Prathap Maverick wrote:

If suppose, i want to input data through syntax for the following data

Age Name

23 Abc
54 Xyz
34 Pqr

One can easily do it by following syntax

data list list
/ Age * Name (A3).
begin data.
23 ABC
54 XYZ
34 PQR
End data.

In the above program, please note that the problem i have faced is that i cannot have Name as first variable.


I really DON'T understand that sentence


But, if i want to have the values for Name like Name with their Surname by giving blank in between the name & surname i am unable to do data entry.

For eg.

data list list
/ Age * Name (A7).
begin data.
23 ABC abc
54 XYZ xvz
34 PQR pqr
End data.


I tried this:

data list list
/ Age * Name (A7).
begin data.
23 "ABC abc"
54 "XYZ xvz"
34 "PQR pqr"
End data.

and it worked OK



I am really confused how to write the proper syntax to do data entry with all the variable properties specified in it. I believe, there are lots of flaws in spss syntax.

Did you try to read the manual? It helped me a lot when I was a beginner, like you now.

Regards,
Marta GG