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?

 

 

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: 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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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