Good idea. However, I am not sure how to do this. I used the code Arthur provided as it dealt with the issue of the large number of variables I have in my dataset (code again below). Not sure how I can modify this to specify each variable in the dataset to export (I have about 20 character long comment variables and 1000s of other clinical variables). Thanks again. /*create a format to use*/ proc format; value codes 999='Yes'; run; /*create a test data set*/ data whatever; retain a1-a1000 (1000*"just some test stuff, i.e., meaningless filler"); retain b1-b1000 (1000*999); format b1-b1000 codes.; do _n_=1 to 500; output; end; run; proc sql noprint; select '"'||trim(name)||'"' into :names separated by " ','" from dictionary.columns where libname eq "WORK" and memname eq "WHATEVER" ; quit; data _null_; set whatever; file "c:\whatever.csv" dlm=',' dsd lrecl=200000; format _all_; if _n_ eq 1 then put &names.; put (_all_) (+0); run;
... View more
I was viewing in both. I will check the wrapping. Strangely when I dropped the long character variables (comment variables), the export worked. Not a great fix but it's something. Thanks for your help!
... View more
Yes, they do have commas--sometimes more than one (var1, var2,,,,,,,,,var3 for example). Some of my character variables are greater than 200 in length so I tried formatting them to 199 in a dataset but this still did not work.
... View more
Hello Arthur, First, thank you for posting this code--I found it very helpful as it allowed me to export (to csv) all of my variables names (first row as header). However, around rows 20 I am having another issue where rows are no long being read correctly. This can be seen when I open up the txt file and ID variable is now blank and other variable values following are incorrect. This may be due to the fact that I have some very long character variables? Other than this idea I am at a loss and have spent 3 days trying to rectify this issue with no luck. Any help would be greatly appreciated.
... View more