DATA Step, Macro, Functions and more

how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

Accepted Solution Solved
Reply
Contributor
Posts: 23
Accepted Solution

how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

 

Accepted Solutions
Solution
‎11-21-2016 09:35 AM
Super User
Posts: 10,023

Re: how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

1) IML code.
2) Write a macro and CALL EXECUTE:

%macro xx(dsn=);
  proc print data=&dsn;
   var variables-list ;
 run;
%mend;

data _null_;
 set sashelp.members(where=(libname='WORK'));
call execute('%xx(dsn=work.'||memname||')');
run;

View solution in original post


All Replies
Super User
Posts: 19,772

Re: how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

You still need to post more details...

Contributor
Posts: 23

Re: how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

Can you plz give me an example?
Super User
Posts: 19,772

Re: how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

 

 

What are are you trying to do? What do you have for starter, text files, sas datasets, SQL DB? What do you mean by read variables? What do you need as output? 

 

Here are some guidelines on asking good questions

 

http://stackoverflow.com/help/how-to-ask

 

https://communities.sas.com/t5/SAS-Communities-Library/How-to-ask-a-question-in-SAS-Analytics-U-Comm...

Contributor
Posts: 23

Re: how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

Sorry , i don't know about this.. this is an interview question people have asked me. Im struggling as well like you.
Super User
Posts: 19,772

Re: how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

That was the question? Word for word? 

 

How familiar are you with SAS? 

Contributor
Posts: 23

Re: how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

as in SAS datasets... it can be any type of variables.
Respected Advisor
Posts: 4,173

Re: how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

[ Edited ]

That's a too generic and unspecified question to just give a straight answer.

 

Such a question in an interview situation provides you with the opportunity to demonstrate your analytical approach to requirement analysis and to showcase your understanding of SAS by asking back the right questions to get to the necessary level of detail for an answer.

 

It's in this regard a really good interview question as you need actual experience and knowledge to deal with it.

Super User
Posts: 19,772

Re: how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

Last set of interviews I did, they received a technical take home exam, and I asked a question I thought was totally clear. 

Of the 6 candidates - one candidate realized it was ambiguous and asked clarifying questions. That's the one I hired. 

3 others interpreted it one way and 2 the other way. 

 

 

Super User
Posts: 5,426

Re: how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

Interview questions? Sigh...
C'mon, learn SAS the proper way, and then you can attend interviews with confidence. Just learning by answering some random question will not get you to understand SAS and be pruductive. Also, can you predict what question that will be asked?
Data never sleeps
Solution
‎11-21-2016 09:35 AM
Super User
Posts: 10,023

Re: how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

1) IML code.
2) Write a macro and CALL EXECUTE:

%macro xx(dsn=);
  proc print data=&dsn;
   var variables-list ;
 run;
%mend;

data _null_;
 set sashelp.members(where=(libname='WORK'));
call execute('%xx(dsn=work.'||memname||')');
run;

Super User
Posts: 10,023

Re: how to read multiple variable from multiple datasets like 200 variables from 100 datasets?

1) IML code.
2) Write a macro and CALL EXECUTE:

%macro xx(dsn=);
  proc print data=&dsn;
   var variables-list ;
 run;
%mend;

data _null_;
 set sashelp.members(where=(libname='WORK'));
call execute('%xx(dsn=work.'||memname||')');
run;

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 11 replies
  • 334 views
  • 2 likes
  • 5 in conversation