LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 18 Jun 2002 12:30:48 -0500
Reply-To:   Anthony Pitruzzello <statman45@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Anthony Pitruzzello <statman45@HOTMAIL.COM>
Subject:   %IF %THEN %ELSE Question
Content-Type:   text/plain; format=flowed

Greetings, everyone.

Hopefully, someone can help me with a macro question. Here’s a stripped-down version of the program:

*** Specify a set of years; %LET A = 1997; %*Set start year; %LET B = %EVAL(&A +1); %LET C = %EVAL(&A +2); %LET D = %EVAL(&A +3); %LET E = %EVAL(&A +4); %LET F = %EVAL(&A +5);


DATA T&X; INFILE TAP&X; INPUT @10 GRDT&X 2. @17 LVLT&X 2. @19 STBL&X $1. @20 SPC_CODE $3. @24 BILIND 1. @29 LEPCD 1. @72 SID 8. @166 RPR&X 2. @635 ACCOM 1. @698 UNT&X 4.; %IF RPR&X < 25 %THEN Q&X=1; %ELSE Q&X=2; RUN; PROC PRINT DATA=T&X (OBS=5); %END; %MEND RDCTAP; %RDCTAP

The larger program can be run for 6 years or fewer and requires numerous references to variables with a year suffix (e.g., unt2001, unt2002). The objective is to update those references easily. The program runs fine without the %IF statement. However, once that statement is inserted, I get the following error message:

Line generated by the invoked macro "RDCTAP". RUN; ___ ___ ___ 22 Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, LE, LT, MAX, MIN, NE, NG, NL, OR, =, |, ||, ~=.<, <=, <>, =, >, ><, >=, AND, EQ, GE, GT,

Curiously, if I alter the statement to IF, THEN, ELSE without the %, it runs correctly. Does anyone know why? Also, many thanks to Ian Whitlock and Ron Fehd for their help with a previous macro question.

_________________________________________________________________ Send and receive Hotmail on your mobile device:

Back to: Top of message | Previous page | Main SAS-L page