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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.