ODS Error

Reply
Regular Contributor
Posts: 222

ODS Error

Hi there....When I use a macro variable to specify a the name of a folder in the file statement, I get an error message which is because blank spaces still remain even when I have used the STRIP function. I have attached part of the code as well as the error message....thanks in advance

DATA _NULL_;
  fyear1 = put(intnx('year.4',intnx('Month',today(),-1,'B'),0,'B'),year.);
  fyear2 = substr(put(intnx('year.4',intnx('Month',today(),-1,'E'),0,'E'),year.),3,2);
  fyear = strip(input((fyear1||fyear2),6.)||' '||'Fiscal Year');
  endperiod1 = propcase(put(intnx('Month',today(),-1,'E'),monyy7.));
  endperiod2 = substr(endperiod1,1,3);
  endperiod3 = substr(endperiod1,4,4);
  endperiod6 = put(intnx('Month',today(),-1,'E'),monyy7.);
  endperiod7 = substr(endperiod6,1,3);
  endperiod5 = trim(trim(endperiod7)||' '||trim(endperiod3));
  year_month1 = put(year_month,6.);
  endperiod = input(endperiod4,$8.);
CALL Symput ('fyear', fyear);;
CALL Symput ('endperiod5', endperiod5);

RUN;

ods tagsets.excelXP file="U:\EDS Monthly\&fyear\EDS Monthly - &endperiod5..xls";


Error Message:

190        ods tagsets.excelXP file="U:\EDS Monthly\&fyear\EDS Monthly -
190      ! &endperiod5..xls";
NOTE: Writing TAGSETS.EXCELXP Body file: U:\EDS Monthly\201314 Fiscal Year      \EDS
      Monthly - DEC 2013       .xls
ERROR: Physical file does not exist, U:\EDS Monthly\201314 Fiscal Year      \EDS Monthly
       - DEC 2013       .xls.

Super User
Posts: 10,550

Re: ODS Error

Your strip on Fyear is only doing the input() part.

Try

  length fyear $ 18 ;

  fyear = catx(' ',(fyear1||fyear2),'Fiscal Year');

Super Contributor
Posts: 644

Re: ODS Error

Try using symputx ().

Or %Let fyear = &fyear ;

Call Symput will create a macro variable which has the same total length as the number of characters in the data set variable, irrespective of whether the value is trimmed or not.

Richard.

Ask a Question
Discussion stats
  • 2 replies
  • 142 views
  • 0 likes
  • 3 in conversation