Proc Sql Question

Reply
Frequent Contributor
Posts: 124

Proc Sql Question

I would like to know if I have a dataset with variables such as var1-var12, how can I use the select statement with these variables. 

For example:  Can I do something like select id, var: from dataset1?  or I have to do select id, var1,var2, var3,....  var12 from dataset1

Super User
Posts: 17,828

Re: Proc Sql Question

You have to explicitly list the variables for PROC SQL.

There are ways to simplify this.

You can select all with select *

or all from a table,

select a.*

from sashelp.class as a

Or my lazy trick:

proc sql FEEDBACK;

select *

from sashelp.class AS a;

quit;

And check the log for the list of variables, rather than type them out Smiley Happy

Ask a Question
Discussion stats
  • 1 reply
  • 133 views
  • 1 like
  • 2 in conversation