BookmarkSubscribeRSS Feed
Xamius32
Calcite | Level 5

And create another dataset and add a row to the second dataset explaining the problem with X variable, so I any number of variables/explinations would need to be added to other dataset. So I am trying to figure out how to do this in an array (IE add 3 variables to the array and then add a row for each variable to say this variable has a problem)

My dataset looks like:

VariableXY
A12
B1.5

So the condition might be if X>Y then add a variable to array, and then I want to create dataset test and add a row saying variable X has X>Y

Is this possible and does it make sense

1 REPLY 1
Tom
Super User Tom
Super User

Sounds like you want to create a problem report.  Typically you would include the id variables (so someone can find the offending row), then rule and the key values that violate the rule.

data want ;

    set have ;

    length rule $50 values $50 ;

    keep id rule values ;

    if x > y then do;

       rule = 'X>Y' ;

      values=catx(' ',catx('=','X',x),catx('=','Y',y));

      output;

   end;

run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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