- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Dear SAS users,
I wrote the following:
%let Jahr = 2021 ; * Hier das Jahr einsetzten ;
%put &Jahr.;
%if &Jahr = 2021 %then %do;
%let Quelldatei="GESAMT_WTL_RKR"; %end.;
%else %do;
%let Quelldatei="GESAMT_JHR_RKR_&Jahr.";
%end;
and gets :
26 %let Jahr = 2021 ; * Hier das Jahr einsetzten ;
27 %put &Jahr.;
2021
28
29 %if &Jahr. = 2021 %then %do;
30 %let Quelldatei="GESAMT_WTL_RKR"; %end.;
30 %let Quelldatei="GESAMT_WTL_RKR"; %end.;
_
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
WARNING: Apparent invocation of macro END not resolved.
ERROR: The %ELSE statement is not valid in open code.
31 %else %do;
32 %let Quelldatei="GESAMT_JHR_RKR_&Jahr.";
33 %end;
how can I correct this?
regards
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
looks like you have a period (.) at the end of your %end:
%let Quelldatei="GESAMT_WTL_RKR"; %end.;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
looks like you have a period (.) at the end of your %end:
%let Quelldatei="GESAMT_WTL_RKR"; %end.;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Adding:
Rarely is it necessary to put macro variable values in quotes. Instead of
%let Quelldatei="GESAMT_WTL_RKR";
you'd probably be better off using
%let Quelldatei=GESAMT_WTL_RKR;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I wish you a happy and successfull year 2021.
Thank you for your help in 2020,
Regards