Then you can't use proc export and instead you have to do some of the heavy lifting it does in the background. You can access a table containing the metadata (names and labels) and put them into some macro variables: Proc SQL noprint ; /* column names header row */ Select name into :namelist separated by ',' From dictionary.columns Where libname = 'WORK' And memname = 'TEST' ; %Put &namelist ; /* column labels header row */ Select label into :labellist separated by ',' From dictionary.columns Where libname = 'WORK' And memname = 'TEST' ; %Put &labellist ; /* variables for put statement */ Select name into :putlist separated by ' ' From dictionary.columns Where libname = 'WORK' And memname = 'TEST' ; %Put &putlist ; Quit ; Then create the output file (notice I've added an extension so Excel will recognise it) : data _null_; set test; file 'C:\temp\output.csv' delimiter=',' DSD DROPOVER LRECL=256; if _n_=1 then do; put "&namelist"; put "&labellist"; end; put &putlist ; Run ; The output.csv file contents are id,var1,var2 sid,value1,value2 1,2,3 2,4,4 3,4,2 4,2,1 5,2,3 6,3,9 which, unless you've altered Excel defaults, will open as the table required. Note that this is a simplified version of what proc export does behind the scenes and assumes that formats have already been assigned or that the defaults are satisfactory. BTW do not put WORK and TEST in lower case in the SQL. Richard in Oz
... View more