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
Super User

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?

 

 

The Boston Area SAS Users Group (BASUG) is hosting an in person Meeting & Training on June 27!
Full details and registration info at https://www.basug.org/events.
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-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

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
  • 4 replies
  • 1158 views
  • 0 likes
  • 3 in conversation