Hi,
I need to create dummy variable EVENT, which take value one in trading days 0 and +1, I have a column called window, which present trading days, which values goes -16 through + 16, so when window is 0 and 1, event should get value 1, and otherwise event=0
How to do this?
I get error message that statement is not valid or it is used out of proper order.
I use SAS University Edition
have tried to do this:
event=0,
if window=1 or window=0 then event=1;
Thank you,
-beginner
HI @Kati
It seems you have a typo -> the coma should be a semi-colon:
event=0, -> event=0;
if window=1 or window=0 then event=1;
OK. Could you please share a sample of your data and the full data step code you are using ?
Here is some code that could answer your question.
Could you please compare your code ?
data have;
input window;
datalines;
-16
1
7
0
;
run;
data want;
set have;
event = 0;
if window = 0 or window = 1 then event = 1;
run;
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!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.