The manipulated data are character strings defined directly in the script via macro variables. There is no reading of external or internal SAS datasets (like SASHELP) nor creation of traditional SAS datasets.
1 Code Block
Macro
Explanation : This block initializes the macro variable `varlabel` with a list of vaccines. It then uses the `%SCAN` macro function to extract the first value ('Flu vaccine') from `varlabel`, using the comma as a separator, and assigns it to the macro variable `bbb`. The `quit;` statement terminates any potentially open SAS procedure, although none is active here. Finally, `%PUT` writes the value of `bbb` to the SAS log, thereby verifying the correct extraction.
Copied!
%let varlabel= Flu vaccine,Tetanus-diptheria,Hepatitis B vaccine,Hepatitis A vaccine,PPD,Pneumovax;
%let bbb= %scan("&varlabel",1,',');
quit;
%put the 1st is &bbb;
1
%let varlabel= Flu vaccine,Tetanus-diptheria,Hepatitis B vaccine,Hepatitis A vaccine,PPD,Pneumovax;
2
3
%let bbb= %scan("&varlabel",1,',');
4
QUIT;
5
%put the 1st is &bbb;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.