Reputation: 2587
I have a table that looks like this:
Country Austria Belgium Germany Italy ....
I'm trying to subset some records (Austria and Belgium) of the variable Country in this way but it does not work:
DATA mydata; SET mydata; KEEP Austria Belgium; RUN;
I used this piece of code from here https://stats.idre.ucla.edu/sas/modules/ubsetting-data-in-sas/ where some examples of subsetting data are reported. Unfortunately it does not work.
Can anyone help me please? I'm new in SAS.
Kind regards
Upvotes: 0
Views: 29
Reputation: 12465
What you are looking for is a sub-setting if
DATA mydata;
SET mydata;
if country in ('Austria', 'Belgium');
RUN;
You have to check if the variables equals those values. What you have in your code is telling SAS to keep columns Austria
and Belguim
in the output data. Those are values, not columns.
Upvotes: 1