VARS TO CASES With Unknown Number of Variables

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

VARS TO CASES With Unknown Number of Variables

Krinsky, Alan-2
Is it possible to run a VARS TO CASES operation without knowing how many variables one has?
 
For example, something that would in effect run this:
 
VARSTOCASES
  /MAKE date FROM date.1 to date.n
 
I want to run my syntax without having to pause to identify the number of variables (produced in a previous CASES TO VARS operation) and code manually each time.
 
Thanks for the assistance, and be well!
 
Alan
 
 
Alan D. Krinsky  PhD, MPH
Senior Data Analyst
Office of Clinical Integration
UMass Memorial Health Care
38 Oak Ave.
Worcester, MA 01605
E-mail: [hidden email]
 
 
 

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, transmission, re-transmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
Reply | Threaded
Open this post in threaded view
|

Re: VARS TO CASES With Unknown Number of Variables

Andy W
One way is if you know that date.1 to date.n are at the end of the variable list, you can add a filler variable and then drop it after the VARSTOCASES.

numeric @ (ADATE10).
VARSTOCASES  /MAKE date FROM date.1 to @ /INDEX id (date).
SELECT IF id <> "@".

If you have other variables (or the date.? variables are not at the end of the list) this trick won't work.

Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: VARS TO CASES With Unknown Number of Variables

Jon K Peck
However, doing this through Python programmability would be a piece of cake.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Andy W <[hidden email]>
To:        [hidden email],
Date:        01/30/2014 03:46 PM
Subject:        Re: [SPSSX-L] VARS TO CASES With Unknown Number of Variables
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




One way is if you know that date.1 to date.n are at the end of the variable
list, you can add a filler variable and then drop it after the VARSTOCASES.

numeric @ (ADATE10).
VARSTOCASES  /MAKE date FROM date.1 to @ /INDEX id (date).
SELECT IF id <> "@".

If you have other variables (or the date.? variables are not at the end of
the list) this trick won't work.





-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/VARS-TO-CASES-With-Unknown-Number-of-Variables-tp5724242p5724252.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