BookmarkSubscribeRSS Feed
HarshadMadhamshettiwar
Obsidian | Level 7

Experts,

Below is the output result of proc compare which compares two data sets and tells whether observations have matching values for variables. It the values are matching it gives the difference as 0 otherwise the calculated value.

Now I want to limit this data to only those "C_name" for which all "_OBS_" are having "Value"=0 .


Kindly see c_name "onn" is having one zero for its set of data and I dont want data relating to ONN to be in my new dataset. I only want those C_name for which all obs have 0 values; so the condition need to check whether the "value" is 0 for all the unique "C_names" .


One more thing the _OBS_ reference may change i.e here I have posted only 6 but originally this number may be huge so its better if we have something which is dynamic and automatically COUNTS the number of _OBS_ for unique c_names which will be same for all c_name.

_TYPE__OBS_C_namemetricvalue
DIF1heroar_y188
DIF2heroar_y2-22
DIF3heroar_y3-22
DIF4herocash_y179
DIF5herocash_y2-10
DIF6herocash_y3-10
DIF1onnar_y10
DIF2onnar_y2-20
DIF3onnar_y3-20
DIF4onncash_y10
DIF5onncash_y2-22
DIF6onncash_y375
DIF1yuar_y10
DIF2yuar_y20
DIF3yuar_y30
DIF4yucash_y10
DIF5yucash_y20
DIF6yucash_y30

Requirement in NUTSHELL:

ALL the C_names which have all the values zero for all the obs (here we have only one C_name which fits our criteria  and that is "YU").

Thanks a lot...!

2 REPLIES 2
art297
Opal | Level 21

You appear to have posted this question twice. I gave an answer in the other thread that has the same name.

AnnaBrown
Community Manager

Thanks for answering this art297.

For reference, the other thread can be found here:

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1021 views
  • 0 likes
  • 3 in conversation