create variable with syntax

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

create variable with syntax

Moon Kid
Hi at all,

I want to create the variables with syntax. I just want to create them,
I don't want to fill them with data.

I want to do with syntax exactly the same as I can do on the variable
view. Conrecte I want to specify
- name
- type
- width
- decimals
- label
- values
- missing
- align
- measure

In the syntax ref I found no command that offers this simple job.

=====================
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: create variable with syntax

Rick Oliver-3
It's a combination of commands

For numeric variables, the NUMERIC command will define name, type, width, number of decimals.
For string variables, the STRING command will define name and width.

After that:
VARIABLE LABEL
VALUE LABELS
MISSING VALUES
VARIABLE LEVEL
VARIABLE ALIGNMENT (for alignment in the Data Editor)
VARIABLE WIDTH (for display width in the Data Editor)

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        Moon Kid <[hidden email]>
To:        [hidden email],
Date:        03/21/2014 11:01 AM
Subject:        create variable with syntax
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi at all,

I want to create the variables with syntax. I just want to create them,
I don't want to fill them with data.

I want to do with syntax exactly the same as I can do on the variable
view. Conrecte I want to specify
- name
- type
- width
- decimals
- label
- values
- missing
- align
- measure

In the syntax ref I found no command that offers this simple job.

=====================
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: create variable with syntax

Christopher Stride
In reply to this post by Moon Kid
This will create e.g. 10 blank vars for 20 cases

INPUT PROGRAM.
LOOP #I=1 TO 20.
VECTOR X(10).
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
exe.

If you already have cases in the data then

VECTOR X(10).

does the same.

Then use rename, variable label, value label, format and variable level
commands respectively to set attrributes.





On 21/03/2014 15:54, Moon Kid wrote:

> Hi at all,
>
> I want to create the variables with syntax. I just want to create them,
> I don't want to fill them with data.
>
> I want to do with syntax exactly the same as I can do on the variable
> view. Conrecte I want to specify
> - name
> - type
> - width
> - decimals
> - label
> - values
> - missing
> - align
> - measure
>
> In the syntax ref I found no command that offers this simple job.
>
> =====================
> 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