Reputation: 43
I have a problem in SAS, I would like to know how can I input several columns in only one column(put everything in a single variable)?
For example, I have 3 columns but I would like to put this 3 columns in only one column. like this:
1 2 3
1 3 1
3 4 4
output:
1
1
3
2
3
4
3
1
4
Upvotes: 2
Views: 198
Reputation: 21294
I'm assuming you're reading from a file, so use the trailing @@ to keep reading variables past the end of the line:
data want;
input a @@;
cards;
1 2 3
1 3 1
3 4 4
;
run;
Upvotes: 3
Reputation: 438
If the dataset is not big just split it to several small data set with one variable each, then rename all variables to one name and concatenate vertiacally using simple set statement. I am sure there are more elegant solutions than this one and if your data set is big let me know, I will write the actual code needed to perform this action with optimal coding
Upvotes: 0