i have a data as follows
Variable X
Obs. 12345
Now I want output like as follows
Variable X Y Z A B C
Obs. 1 2 3 4 5 6
How we can do this
data have; input Variable $ X ; cards; Obs. 12345 ; data w; set have; length x1 $5; array new_x [5] $1 ; x1=strip(put(x,8.)); call pokelong (x1,addrlong(new_x[1]),length(x1)); run;
View solution in original post
There is no "6" in the source data. From where do you get it?
@Son_Of_Krypton wrote: i have a data as follows Variable X Obs. 12345 Now I want output like as follows Variable X Y Z A B C Obs. 1 2 3 4 5 6 How we can do this
Why do you want to call column names XYZ ABC? Doesn't seem good. Anyways;
data want; set have; array t{5} $1 y z a b c; do i=1 to 5; t{i}=char(x,i+1); end; x=char(x,1); run;
Note, again no test data in the form of datastep, so guessing on a lot of things!
April 27 - 30 | GAYLORD TEXAN
Register now to lock in early bird pricing through February 25!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.