BookmarkSubscribeRSS Feed
Rita2021
Calcite | Level 5

Hello,

 

I have a base that has cnpj and I want to take the cnpj14 field which is in number and transform it to 8

I have for example string below:

Remember that there may be a leading zero and it is not for counting

data one;
val=1234567;
val1=substr(left(val),1,4); run;
How can i proceed?
And another subject how can I convert where filter to text in sql server via sas??
Thank you very much.
 
Rita 
1 REPLY 1
ChrisNZ
Tourmaline | Level 20

Hi Rita,

You need is unclear, you might want to explain more. What's wrong with your code?

Also, please start a new thread for the second question (which is also unclear)

Also please use the appropriate icon when posting code to make it more legible.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 744 views
  • 0 likes
  • 2 in conversation