BookmarkSubscribeRSS Feed
AmitParmar
Obsidian | Level 7

how to create Create observations depending on the length of the Name.

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Please go back to your original post and provide a meaningful title, one that describes the problem. Since this is the SAS Community, a subject that says "SAS" isn't useful or meaningful. We're trying to help you, but you also have to help us.

 

Also, your problem description needs a lot more detail and information, and probably a small example would help as well.

--
Paige Miller
ballardw
Super User

@AmitParmar wrote:

how to create Create observations depending on the length of the Name.


I think you are missing a few details here. Like exactly how the length of name is to be used, what is supposed to be created and where any values might come from.

 

Example of starting data, rules and an example of the data with the rules applied are a good idea.

 

In a SAS data step you can test the length of a value, the number or characters using the LENGTH function. such as

 

if length(name) = 20 then do;

   <stuff depending on that length goes here>

end;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 2 replies
  • 1209 views
  • 5 likes
  • 3 in conversation