If any Lead number is Present in the Given data it should appear as installed=1
How to Solve this in Proc Sql ?
Ex :
Lead Number Installed
2121221 1
2212154 1
Hello @saikiran_nemani,
Your question requires more details before experts can help. Can you revise your question to include more information?
Review this checklist:
To edit your original message, select the "blue gear" icon at the top of the message and select Edit Message. From there you can adjust the title and add more details to the body of the message. Or, simply reply to this message with any additional information you can supply.
SAS experts are eager to help -- help them by providing as much detail as you can.
This prewritten response was triggered for you by fellow SAS Support Communities member @Kurt_Bremser
.Data step solution
data want;
set have;
if not missing(lead_number) then installed=1;
run;
And yes, a more meaningful title and more information is always appreciated and helpful.
To do that in SQL, use a CASE clause within the SELECT statement.
Unfortunately, the syntax depends on whether LeadNumber is character or numeric, and you haven't yet told us that information.
What value should the new INSTALLED variable have when LEADNUMBER is missing?
It is probably easiest in SAS to just let SAS create the new variable as a boolean number where 1 is true and 0 is false.
For example you could use the SAS function MISSING() to test if LEADNUMBER is missing. And use the NOT operator to take the complement of the result.
proc sql;
select
leadNumber
, not missing(leadNumber) as Installed
from have
;
quit;
Suppose these are the Lead numbers and How do we Create a variable called Install with the Value 1 for each lead number
Data Type : NUMERIC
42129203
43899661
43947460
45396478
45439343
45566313
45599714
Please read the replies already provided above.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.