Hello,
I have a table of codes that I'm trying to select a subset from. However, I can't seem to be able to pull this correctly. Any help will be greatly appreciated!
The table, named tbl_CODES, only has one field, named PROC_CD. However, there is a mix of codes, such as: A1000, A1001, B1000, B2000, 00005, 00003. How do I create a table based on tbl_CODES where PROC_CDs begin with the character "A" only?
It sounds like you want the value of a specific variable, not "variables beginning with 'A' ".
The =: operator is a "begins with.
So an example with a data set you should have available:
proc print data=sashelp.class noobs; where name=:'A'; run;
Prints just the records where the Name variable starts with 'A'.
Or use in a data set option when indicating which data set you are using.
proc print data=sashelp.class(where=( name=:'A')) noobs; ; run;
Please show the code you have tried, and also any errors you see in the log. If you have no errors but your code is not working, please describe how the results you are getting differ from what you want.
It sounds like you want the value of a specific variable, not "variables beginning with 'A' ".
The =: operator is a "begins with.
So an example with a data set you should have available:
proc print data=sashelp.class noobs; where name=:'A'; run;
Prints just the records where the Name variable starts with 'A'.
Or use in a data set option when indicating which data set you are using.
proc print data=sashelp.class(where=( name=:'A')) noobs; ; run;
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!
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.