I'm able to run the job and read the sas ouput file, but i can't seem to get the filename csvout '...' to spit out the csv. my output statement notes 100k observations with 9 variables. in the filename statement, i've tried lrecl=500, 1000, i didn't include it at all. I've also tried recfm=v, and leaving it out. any ideas why this csv is not being generated? i get the log and the output, with all 100k records, but i cant get the csv. I've looked through the log and theres nothing noting a probelm with the csv output.
Please post your code. And the log of the data step that is supposed to create the csv.
libname in1 '/a/b/c' ;
filename csvout '/d/e/list.csv' lrecl=1000 recfm=v;
DATA TEMP;
SET in1;
KEEP g h;
IF '24FEB17:00:00'DT < STARTIME < '24FEB17:24:00'DT;
IF g IN: (
'x',
);
IF h IN:(
'y',
;
PROC SORT NODUP DATA=TEMP; BY x y;
PROC PRINT NOOBS UNIFORM;
313 PROC PRINT NOOBS UNIFORM;
NOTE: There were 100010 observations read from the data set WORK.TEMP.
NOTE: The PROCEDURE PRINT printed pages 1-1786.
NOTE: PROCEDURE PRINT used (Total process time)
There are no errors or anything which speaks to the csv. I did a search an the only occurance of csv is in my filename statement.
please excuse the smiley sad haha
First of all, post your code using the "little running man" symbol or the {i}. This preserves formatting and prevents the display of smileys.
libname in1 '/a/b/c' ;
filename csvout '/d/e/list.csv' lrecl=1000 recfm=v;
DATA TEMP;
SET in1;
KEEP g h;
IF '24FEB17:00:00'DT < STARTIME < '24FEB17:24:00'DT;
IF g IN: (
'x',
);
IF h IN:(
'y',
;
PROC SORT NODUP DATA=TEMP; BY x y;
PROC PRINT NOOBS UNIFORM;
You only define a filename. If you never use the file reference defined here, nothing is ever written to the file.
There are other problems with your code, see my comments:
libname in1 '/a/b/c' ;
filename csvout '/d/e/list.csv' lrecl=1000 recfm=v;
data temp;
set in1; /* this does not read from library in1, but from dataset work.in1! */
keep g h;
if
'24FEB17:00:00'DT < STARTIME < '24FEB17:24:00'DT
and g IN ('x')
and h IN ('y')
;
run;
/* at this point, work.temp contains only variables g and h */
proc sort
data=TEMP
nodupkey
;
by x y; /* this won't work, as no variable x or y has been created in one of the previous steps */
run;
data _null_;
set TEMP;
file csvout dlm=',' dsd;
if _n_ = 1 then put 'g;h';
put g h;
run;
Thank you for point out the little running man. I'll be aware of that for next time.
I ended up running this code:
ods csv file='/a/b/list.csv';
PROC PRINT data = temp NOOBS UNIFORM;
run;
ods csv close;
my csv was output with no problems.
I codejacked that filename csvout from another job. I need to be better about choosing which statements to use, and learn the differences.
Thanks for taking the time to help me, Kurt.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.