Hello I have data like this:
Large Corporate - CCAR Scenario | |||
Q2-2020 data | q1 | q2 | q3 |
I-1 | 1 | 2 | 3 |
I-2 | 4 | 5 | 6 |
I-3 | 7 | 8 | 9 |
US Commercial - CCAR Scenario | |||
Q2-2020 data | q1 | q2 | q3 |
I-1 | 1 | 2 | 3 |
I-2 | 4 | 5 | 6 |
I-3 | 7 | 8 | 9 |
And I want to change my table like this:
Sector | FROM_RISK_RATING | scenario_date | MIGRATION_PROB_D |
Corporate | I-1 | Q2-2020 | 1 |
Corporate | I-2 | Q2-2020 | 2 |
Corporate | I-3 | Q2-2020 | 3 |
Corporate | I-1 | Q2-2020 | 4 |
Corporate | I-2 | Q2-2020 | 5 |
Corporate | I-3 | Q2-2020 | 6 |
Corporate | I-1 | Q2-2020 | 7 |
Corporate | I-2 | Q2-2020 | 8 |
Corporate | I-3 | Q2-2020 | 9 |
Commercial | I-1 | Q2-2020 | 1 |
Commercial | I-2 | Q2-2020 | 2 |
Commercial | I-3 | Q2-2020 | 3 |
Commercial | I-1 | Q2-2020 | 4 |
Commercial | I-2 | Q2-2020 | 5 |
Commercial | I-3 | Q2-2020 | 6 |
Commercial | I-1 | Q2-2020 | 7 |
Commercial | I-2 | Q2-2020 | 8 |
Commercial | I-3 | Q2-2020 | 9 |
How can I change the format in SAS? Thanks!
What file type is the data for the "have" data?
already transferred as sas data, used to be in excel
Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.
however, my original data is larger than this, so I need to transpose the original data
I've attached a file for further explanation. So the original file is in excel and I want to import it into SAS and make the format as the desired tab.
Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.
Subset your data an use the macro to create an example data set using the link I posted earlier.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.