Hello,
I am trying to write a logic and have been getting an error. "statement is not valid or it is used out of proper order"
Could you help me figure out the mistake in these statements
data want;
set have;
IF (PalS_N/19 > .50) THEN
PalS = SUM(PAL1,PAL2,PAL3,PAL4, B1, PAL5, C2, O2, PAL6, PAL7, Br7, PAL8, PAL9,PAL10, Sp21, PAL12, L1, PAL13, PAL14)*19/(PalS_N);
ELSE IF (PalS_N/19 < .50) THEN PalS =SUM(PAL1,PAL2,PAL3,PAL4, B1, PAL5, C2, O2, PAL6, PAL7, Br7, PAL8, PAL9,PAL10, Sp21, PAL12, L1, PAL13, PAL14);
run;
run;
Show your log. And what happens if it equals 0.5?
@robertrao wrote:
Hello,
I am trying to write a logic and have been getting an error. "statement is not valid or it is used out of proper order"
Could you help me figure out the mistake in these statements
data want;
set have;
IF (PalS_N/19 > .50) THEN
PalS = SUM(PAL1,PAL2,PAL3,PAL4, B1, PAL5, C2, O2, PAL6, PAL7, Br7, PAL8, PAL9,PAL10, Sp21, PAL12, L1, PAL13, PAL14)*19/(PalS_N);
ELSE IF (PalS_N/19 < .50) THEN PalS =SUM(PAL1,PAL2,PAL3,PAL4, B1, PAL5, C2, O2, PAL6, PAL7, Br7, PAL8, PAL9,PAL10, Sp21, PAL12, L1, PAL13, PAL14);run;
run;
Thanks Reeza for the reply.
If it equals 0.5 then it is to be included in the less than or equal to category (PalS_N/19 <= .50).
The following is the error
ERROR 180-322: Statement is not valid or it is used out of proper order.
Thanks Reeza,
It finally worked. I had some RUN statements in between the statements and forgot to remove them !!!!
This statement worked!!!
IF (PalS_N/19 > .50) THEN
PalS = SUM(PAL1,PAL2,PAL3,PAL4, B1, PAL5, C2, O2, PAL6, PAL7, Br7, PAL8, PAL9,PAL10, Sp21, PAL12, L1, PAL13, PAL14)*19/(PalS_N);
ELSE PalS =SUM(PAL1,PAL2,PAL3,PAL4, B1, PAL5, C2, O2, PAL6, PAL7, Br7, PAL8, PAL9,PAL10, Sp21, PAL12, L1, PAL13, PAL14);
I hope you regard your discovery of the problem diagnosis and fix as a demonstration of the wisdom of @Reeza 's request for the full log.
I do.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.