CSV output not appearing

Reply
Occasional Contributor
Posts: 12

CSV output not appearing

[ Edited ]

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.

Super User
Posts: 7,834

Re: CSV output not appearing

Posted in reply to prolifious

Please post your code. And the log of the data step that is supposed to create the csv.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 12

Re: CSV output not appearing

Posted in reply to KurtBremser


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 INSmiley Sad
'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.  

Occasional Contributor
Posts: 12

Re: CSV output not appearing

Posted in reply to prolifious

please excuse the smiley sad haha

Super User
Posts: 7,834

Re: CSV output not appearing

[ Edited ]
Posted in reply to prolifious

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;

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 12

Re: CSV output not appearing

[ Edited ]
Posted in reply to KurtBremser

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.

Ask a Question
Discussion stats
  • 5 replies
  • 138 views
  • 0 likes
  • 2 in conversation