How can use sas code to convert the following data:
V-1 | V-2 | P-L | P-H | Model | ListOrder | CScore | V-L | V-H | Fscore | RuleNo |
AL | BALDWIN | 0 | 999999999 | P | 1 | 0 | 100000 | 1000000 | 10 | 1 |
AL | ELMORE | 0 | 999999999 | V | 1 | 93 | 100000 | 1000000 | . | 2 |
to:
RuleNo | Seq | V-1 | V-2 | P-L | P-H | Price-AVM | Price-Fraud | Variables | ServiceCount | Model |
1 | 1 | AL | BALDWIN | 0 | 999999999 | 0 | 0 | 1 | P | |
1 | 2 | S-C | 0 | |||||||
1 | 3 | F-C | 0 | |||||||
1 | 4 | Fscore | 10 | |||||||
1 | 5 | VALUE RANGE | 100000-1000000 | |||||||
2 | 1 | AL | ELMORE | 0 | 999999999 | 0 | 0 | 1 | V | |
2 | 2 | S-C | 0 | |||||||
2 | 3 | F-C | 0 | |||||||
2 | 4 | CScore | 93 | |||||||
2 | 5 | VALUE RANGE | 100000-1000000 |
Your "want" layout is a report, not a data storage one.
Where does "Variables" and "ServiceCount" come from?
Once you got them into place, this looks like a proc print to me.
Service count will always be 1 for each rule. Variables is the new column of row variables introduced as required by the template.
I do no see an obvious source for Price-AVM, Price-Fraud or where a Model Value comes from for S-C or F-C.
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!
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.