Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List only the column names of a dataset

Tags:

sas

I am working on SAS in UNIX env and I want to view only the column name of a dataset. I have tried proc contents and proc print but both of them list a lot of other irrevelant information that I do not want as it fills up my putty screen and the information ultimately is lost.

I also tried to get this thing frm the sas metadata but that is not working either. I tried :

  2? proc sql;
  select *
 from dictionary.tables
 where libname='test' and memname='sweden_elig_file_jul';
quit;
  5?
NOTE: No rows were selected.

  6?
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.27 seconds
      cpu time            0.11 seconds
like image 944
siso Avatar asked Jul 25 '13 07:07

siso


1 Answers

You're using the wrong dictionary table to get column names...

proc sql ;
  select name 
  from dictionary.columns
  where memname = 'mydata'
  ;
quit ;

Or using PROC CONTENTS

proc contents data=mydata out=meta (keep=NAME) ; 
run ; 
proc print data=meta ; run ;
like image 73
Chris J Avatar answered Oct 23 '22 15:10

Chris J