Hello, I want to drop a variable in a dataset which came from a transpose.
The difficulty here is the number of variables to drop : it can change following the number of columns at the end of the transpose.
I've tried this :
data datasetname;
set datasetname;
array date[&Dimension_tbl.];
do i=1 to &Dimension_tbl.;
drop date{i};
end;
run;
I don't understand why it doesn't work. Of course, the &Dimension_tbl. is defined earlier.
Ok. Then you can use the logic by @LinusH or simply do
drop date:;
Which will drop all variables prefixed with 'date' .
A few things.
Ok. Then you can use the logic by @LinusH or simply do
drop date:;
Which will drop all variables prefixed with 'date' .
No, but you can use a variable range for this:
drop date1-date&Dimension_tbl.;
@LinusH wrote:
No, but you can use a variable range for this:
drop date1-date&Dimension_tbl.;
This is the better answer than use date: variable list. If you drop using the date prefix it might drop other variables that were not intended.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.