Create Variables based on 5 other Numeric variables

Create Variables based on 5 other Numeric variables

Post by Nathaniel. » Sat, 30 May 2009 00:51:15


Tz

This could be done with an array but a very simple solution (from a coding
standpoint) that can work with any number of variables uses a couple
Transposes , a sort. and a merge.

data a;
input ID V1 V2 V3 V4 V5;
cards;
11 5 4 7 3 2
22 3 3 4 2 1
run;

proc transpose data = a out = b;
var v: ;
by id;
run;

proc sort data = b;
by id descending col1;
run;

Proc Transpose data = b( drop = col1 ) out = b ( drop = _:) Prefix = T;
var _name_;
by id;
run;

Data newa;
merge a b;
by id;
run;


Nat Wooding
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
Cel Phone: 804-205-0752



"theepz.info@goog
lemail.com"
<theepz.info@GOOG To
LEMAIL.COM> XXXX@XXXXX.COM
Sent by: "SAS(r) cc
Discussion"
< XXXX@XXXXX.COM Subject
GA.EDU> Create Variables based on 5 other
Numeric variables (decending
order across)
05/28/2009 11:21
AM


Please respond to
"theepz.info@goog
lemail.com"
<theepz.info@GOOG
LEMAIL.COM>






Hi,

I have data set like

ID V1 V2 V3 V4 V5
11 5 4 7 3 2
22 3 3 4 2 1
..

I need to create New varables (T1-T5) based on V1-V5, answer should
be

ID V1 V2 V3 V4 V5 T1 T2 T3 T4 T5
11 5 4 7 3 2 V3 V1 V2 V4 V5
22 3 3 4 2 1 V3 V1 V2 V4 V5
..

Thanks

Regards
Tz


CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.
 
 
 

1. RECODE STRING VARIABLES INTO NUMERIC VARIABLES WITHOUT CREATING NEW VARIABLES

2. RECODE STRING VARIABLES INTO NUMERIC VARIABLES WITHOUT CREATING NEW VARIABLES

Hi Everyone!

I was wondering if it is possible to covert a string variable into a
numeric variable without creating a new variable.
I am dealing with a data set that has over 300 variables that are
coded as string variables that need to be converted into numeric
variables. Given that I am dealing with a large number of variables,
clicking on each of them is a very tedious option. At the same time,
using recode or compute command and creating a set of new variables
will change require writing out a name for each variable. I thought of
an option of dropping the original variables after that recoding and
then renaming recoded variables with names of the original variables,
but it still seems very time consuming, especially if I have to work
with the same problem over and over again.

Thanks,
Anastasia

3. putting the values of 5 different numeric variables into one numeric variable

4. how to create a variable based in others

5. Replacing code based on static variables to variable variables.

6. create a new variable based on the existing variables

7. How to Create a String Variable based on Intervals in a Numerical Variable

8. How to convert Display Variable to Numeric Signed Variable

9. Is possible in PHP, variable that contains others variables?

10. thousands of numeric variables convert to charector variables

11. How to transfer character variables into numeric variables by

12. data from 5 datasets with a numeric variable(out of 5 variables)

13. renaming string variables into numeric variables

14. Concatenate string variables into value labels for a numeric variable

15. Find 2nd highest numeric variable and assign value to new variable (SPSS 16)