BookmarkSubscribeRSS Feed
Zakharkou
Calcite | Level 5

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.

4 REPLIES 4
Quentin
PROC Star

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?

 

 

Check out the Boston Area SAS Users Group (BASUG) video archives: https://www.basug.org/videos.
Zakharkou
Calcite | Level 5

Yes, in principle the variable "name" is blank if var=0. var=1 should restart the numbering.

ballardw
Super User

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.

Zakharkou
Calcite | Level 5
Exactly, you can imagine that there were images to evaluate (file). These images may have been analyzed one or several times and saved as a "name". It is important that there is a consecutive sequentially numbering of these analyses.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 207 views
  • 0 likes
  • 3 in conversation