Dear SAS Community,
I need your help.
I have the following data set:
file name var
file1 0
file2 name1 1
file3 name1 1
file3 name2 1
file4 0
file4 name1 1
The currently question is - how can I check that the entries of variable "name" are always numbered, i.e. always "name1, name2", etc.
And not for example "name1, name3" or "name1, name2, name4".
And if there is a wrong order, how can I convert them beeing numbered correctly.
Thank you in advance.
Is there any logic to determine when name should be blank?
Is there any logic to determine when the name numbering should restart to name1?
Yes, in principle the variable "name" is blank if var=0. var=1 should restart the numbering.
You will need to describe in a bit more detail what you mean by "how can I check that the entries of variable "name" are always numbered, i.e. always "name1, name2", etc.". Do you mean "numbered sequentially"? And possibly "within value groups of the variable named File"?
You would have to show what you expect an output to be given that example as I have no idea what the conversion is supposed to look like.
Also, if the value "name" changes sometimes then your example really should show such. It is quite possible to provide a solution for fixed values, i.e. the text 'name' that will not extend to something where the part of the name changes, such as possibly when the File variable changes.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.