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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.