data base1; set lib.base1; run; proc summary data=base1 nway missing; class prd; var gp; run;
My prd is a set of date. I am required to extract the first 4 digits of it. For example, 202012, and I only need 2020.
Is there any way to extract it? Thank you.
Depends on the type of prd:
Let say it's a string. How would I convert? Can you show me the line of code? Thank you.
data base1;
set lib.base1;
prd2=substrn(prd,1,4);
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.