Hi,
Is there a way of creating a new variable e.g Checked and having all of the records have Y as the result in the checked variable, because I want this 'Y' flag to be apparent (for all records in this ac.list_Jan_Nov dataset) when I left join this dataset onto another dataset? Thanks!
data test;
set ac.list_Jan_Nov;
[What code to include here so that all records in ac.list_Jan_Nov dataset are selected?] .... then Checked='Y';
run;
Is this what you want?
data want;
set sashelp.class;
retain Checked 'Y';
run;
Is this what you want?
data want;
set sashelp.class;
retain Checked 'Y';
run;
Hi,
Thanks for the reply. 'Checked' is currently not a variable in my ac.list_Jan_Nov dataset, but I would like to create the new 'Checked' variable (that is why I wrote then Checked = 'Y'; in the code above) and have all of the records in the ac.list_Jan_Nov dataset have Y for the 'Checked' variable, as all of the records have been checked and when I left join this dataset, I will know that the records in this dataset have been checked. Would the RETAIN statement help to do this?
Have you tried my code?
The variable checked is not in the SASHELP.CLASS data set either. The retain statement ensures that it has the value 'Y' for each record
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 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: