BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
asabou01
Obsidian | Level 7

I have 2 records for one member :

 

data test;
infile datalines;
input flag $ mem_num $ model $;
datalines;
In_Mbr       2001000000000000      HMO
In_clms      2001000000000000      HMO
;

 

Can I get some help make it to one record :

/*
In_both     2001000000000000    HMO
*/

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@asabou01 wrote:

I have 2 records for one member :

 

data test;
infile datalines;
input flag $ mem_num $ model $;
datalines;
In_Mbr       2001000000000000      HMO
In_clms      2001000000000000      HMO
;

 

Can I get some help make it to one record :

/*
In_both     2001000000000000    HMO
*/


You would have to supply every single possible value of Flag variable and then what you want to show for each possible combination of them.

Are there any other variables in the data set? If so which values are kept?

And what can you do with this data that could not be done with the original?

View solution in original post

4 REPLIES 4
Jagadishkatam
Amethyst | Level 16

You can try the below code

 

data test;
infile datalines;
input flag $ mem_num $ model $;
datalines;
In_Mbr       2001000000000000      HMO
In_clms      2001000000000000      HMO
;

proc sql;
create table want as select count(*) as cnt, mem_num, model, 'In_both' as flag from test group by mem_num, model;
quit;

 

 

 

Thanks,
Jag
PeterClemmensen
Tourmaline | Level 20

I don't see the logic here? 

ballardw
Super User

@asabou01 wrote:

I have 2 records for one member :

 

data test;
infile datalines;
input flag $ mem_num $ model $;
datalines;
In_Mbr       2001000000000000      HMO
In_clms      2001000000000000      HMO
;

 

Can I get some help make it to one record :

/*
In_both     2001000000000000    HMO
*/


You would have to supply every single possible value of Flag variable and then what you want to show for each possible combination of them.

Are there any other variables in the data set? If so which values are kept?

And what can you do with this data that could not be done with the original?

asabou01
Obsidian | Level 7

Thank you everyone.   I am all set.   There were only 3 values for flag.

Thanks again.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1214 views
  • 0 likes
  • 4 in conversation