🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 10-04-2018 05:59 AM
(1202 views)
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
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
it was a typing mistake there is no "C" and "6" in data
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;