Selecting variables from a dataset

Reply
Contributor
Posts: 44

Selecting variables from a dataset

Hello,

 

I have a set of columns with countries' names abbreviation and cycle (116 for eg) and I try to cut this dataset into pieces where each table will represent one country. I believe this can be managed with either IF or Where stament but I do not know how to reference column names dynamically.

 

Any idea how to manage this?

 

Attached is the file demonstrating the structure of original table.

 

Thanks

 

Jiri

 

Attachment
Contributor
Posts: 42

Re: Selecting variables from a dataset

[ Edited ]

reference by the country name and double dot BG_: means every column starting with BG_

 

for example:

data BGs(keep = BG_:) CZs(keep = CZ_:) DEs(keep = DE_:) HUs(keep = HU_:) PLs(keep = PL_:);
set BIGDATASET;
run;

 

creates 5 sets with columns respective to countries

Contributor
Posts: 44

Re: Selecting variables from a dataset

Thanks very much!

 

Jiri

Grand Advisor
Posts: 17,310

Re: Selecting variables from a dataset

Look into BY group processing to avoid the need to do this. 

 

Otherwise:

http://blogs.sas.com/content/sasdummy/2015/01/26/how-to-split-one-data-set-into-many/

 

 

Ask a Question
Discussion stats
  • 3 replies
  • 147 views
  • 2 likes
  • 3 in conversation