Reputation: 61
I have a very basic question in SAS. for example, if the dataset called 'a', how can I put 'a' as a new column into this dataset? Thank you very much
Upvotes: 0
Views: 859
Reputation: 51621
Basically you can't. You can make a new dataset.
data new;
set old;
dsname='NEW';
run;
You can use the INDSNAME option on the SET statement to tell you which dataset you are reading data from.
data new ;
length indsname dsname $41 ;
set old indsname=indsname ;
dsname = indsname ;
run;
Makes more sense when the SET statement has more than one dataset referenced. You need to define two variables because the one defined by the INDSNAME= option is automatically dropped.
Upvotes: 1