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 our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 756 views
  • 0 likes
  • 3 in conversation