DATA Step, Macro, Functions and more

i have a null dataset with 10 variables; i want to print only name of the varibales in log window and also output window.how can we do this one?

Reply
Occasional Contributor
Posts: 5

i have a null dataset with 10 variables; i want to print only name of the varibales in log window and also output window.how can we do this one?

am new to sas plz let me kno ans.thanks

Respected Advisor
Posts: 4,173

Re: i have a null dataset with 10 variables; i want to print only name of the varibales in log window and also output window.how can we do this one?

Posted in reply to venkateshn

What is a "null dataset"? Is this a data null step or a table with 0 rows?

Occasional Contributor
Posts: 5

Re: i have a null dataset with 10 variables; i want to print only name of the varibales in log window and also output window.how can we do this one?

sorry it means data _null_;

Respected Advisor
Posts: 4,173

Re: i have a null dataset with 10 variables; i want to print only name of the varibales in log window and also output window.how can we do this one?

Posted in reply to venkateshn

Not perfect but may be all you need.

/* version 1 */

data _null_ ;
   if _n_ = 1 then
   do;
      file print;
      put 'All Vars';
      put _all_;
      file log;
      put 'All Vars';
      put _all_;
   end;

   set sashelp.class;
   /*... more statements ... */

run;

/* version 2 */
data _null_ varlist;
   if 0 then output Varlist;

   set sashelp.class;
   /*... more statements ... */

run;

proc contents data=Varlist nodetails;
quit;

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