BookmarkSubscribeRSS Feed
SanjayM
Calcite | Level 5
I have a dataset with columns code amount single_record_flag

There can be multiple amounts for the same code.

I want to set the value of single_record_flag column to 1 where only one record exists in a group

Please help
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi,
It is not clear what kind of output you want?? A report?? A dataset?? What kind of data is this?

You say the dataset has the following variables or columns:
CODE AMOUNT SINGLE_RECORD_FLAG

Then you say you want to set the value of SINGLE_RECORD_FLAG -- what is the current value of that variable? How did it get into the dataset in the first place?? If all you want to do is create or change a variable value that sounds like a job for FIRST.byvar, or LAST.byvar processing or if you want a report for PROC FREQ or PROC MEANS.

What have you tried??

Cynthia

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 1 reply
  • 929 views
  • 0 likes
  • 2 in conversation