BookmarkSubscribeRSS Feed
amager
Obsidian | Level 7

Hi everyone, 

 

How to select each values changed between base & compare dataset out by proc compare outnoequal ; 

if value equal to ' X.....'  then select variable and row for this values. 

i want to select this value to update into another dataset.

 

Thanks in advance 

9 REPLIES 9
PeterClemmensen
Tourmaline | Level 20

Can you demonstrate this logic by an example?

amager
Obsidian | Level 7
in outnoequal dataset from proc compare. if value had changed it's equal to 'XXX......' . i want to select that value from _COMP_ to update another dataset by the value changed , to do that exacytly i need to find the variable and id of this changed value .. any suggestions. may be have an easy way
Tom
Super User Tom
Super User

@amager wrote:
in outnoequal dataset from proc compare. if value had changed it's equal to 'XXX......' . i want to select that value from _COMP_ to update another dataset by the value changed , to do that exacytly i need to find the variable and id of this changed value .. any suggestions. may be have an easy way

Provide an EXAMPLE.  Post two data steps that can be used to create two datasets. Post the PROC COMPARE code to compare them and create an output dataset.  Show what the resulting output looks like. Explain what you want to select from this dataset. Explain what format you need it in if the way PROC COMPARE creates it is different from how you need it.  Then perhaps someone can help you.  But most likely just doing that will show you how to solve the problem yourself.

amager
Obsidian | Level 7
I modified my questions how can i found expressions in variables like :
.......X....
X...........
...........X
XXXXXXXX....
........XX..
........XXXX
XXXXXXXXXXXX
and not like
............
X1225112.........
which functions can do it exactly ? or i need regular expressions ?? any help
Tom
Super User Tom
Super User

So if the variable is named FRED then check if it contains any X characters.

if indexc(fred,'X') then ....
amager
Obsidian | Level 7
Thanks for your help @Tom , but this can find also 'X1225112.........'
Tom
Super User Tom
Super User
That value will NOT be possible in the DIFF output. It will only have periods or X. There is another variable that can be checked to test which type of observation you have.
amager
Obsidian | Level 7
you are RIGHT @Tom , i Just Chked it but still don't select value with more 'XX' like '.......XXX.....' ,
Tom
Super User Tom
Super User
Post an actual example. For example take the one you are currently look at: eliminate all variables except the one you are currently checking, and any ID variables required to get PROC COMPARE to run ; eliminate all observations except one that matches exactly and one that produces the '...XXX...' value you are having trouble finding. Then post that as self contained code that others can run to reproduce your issue. Or just make up some data to test with.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 9 replies
  • 1554 views
  • 0 likes
  • 3 in conversation