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
Super User

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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 585 views
  • 0 likes
  • 3 in conversation