Hi,
How do I change my tabulate from looking like this.....
Count | Percent | ||
PF | FYMonth | 120 | 0.946 |
A | Dec-17 | ||
Jan-18 | 541 | 8 | |
Nov-17 | 2 | 7 | |
Oct-17 | 6 | 18 | |
B | Dec-17 | 2 | 0.327 |
Jan-18 | 2 | 28 | |
Nov-17 | 276 | 1 | |
Oct-17 | 2 | 7 | |
C | Dec-17 | 2 | 8 |
Jan-18 | 15 | 23.491 | |
Nov-17 | 1 | 7 | |
Oct-17 | 5 | 99 | |
D | Dec-17 | 41 | 8 |
Jan-18 | 2 | 8 | |
Nov-17 | 1 | 0.046 | |
Oct-17 | 4 | 8 | |
E | Dec-17 | 6 | 8 |
Jan-18 | 1 | 84 | |
Nov-17 | 38 | 4 | |
Oct-17 | 48 | 0.033 |
To this.......
Count | Percent | ||
PF | FYMonth | 120 | 0.946 |
A | Dec-17 | ||
A | Jan-18 | 541 | 8 |
A | Nov-17 | 2 | 7 |
A | Oct-17 | 6 | 18 |
B | Dec-17 | 2 | 0.327 |
B | Jan-18 | 2 | 28 |
B | Nov-17 | 276 | 1 |
B | Oct-17 | 2 | 7 |
C | Dec-17 | 2 | 8 |
C | Jan-18 | 15 | 23.491 |
C | Nov-17 | 1 | 7 |
C | Oct-17 | 5 | 99 |
D | Dec-17 | 41 | 8 |
D | Jan-18 | 2 | 8 |
D | Nov-17 | 1 | 0.046 |
D | Oct-17 | 4 | 8 |
E | Dec-17 | 6 | 8 |
E | Jan-18 | 1 | 84 |
E | Nov-17 | 38 | 4 |
E | Oct-17 | 48 | 0.033 |
Do it in a datastep.
Not a verbose answer, its because you have provided no information refer to the help by the post a question button. Post sample test data in the form of a datastep. Post your code using the code window (its the {i}). post logs if they have any information, and show what the output should look like.
You have some 3 or 4 same posts on here at the moment on the same subject, why not close them off and tell us what the real problem is your trying to face rather than start with "must use XYZ".
But you have some base data which you can supply as test data (in the form of a datastep: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...), and you must have some plan or spec of where you want to get to. None of what you post in this question shows what any of it means or where it comes from.
This is the Tabulate code which produces the first table output
proc tabulate data = test.testing;
class pf fymonth;
var count percent;
keylabel SUM = ' ';
tables (pf="PF" * fymonth = "FYMonth"),
(count="Count")
(percent="percent"*f=8.3) /row=float;
run;
In order for us to recreate your situation, we need valid example data.
Please post a sample of test.testing IN A DATA STEP.
This is the datastep
proc sql;
create table test.testing as select
distinct cmonth,
contactnumber,
pf,
fymonth,
from newtest_all
group by cmonth;
@Brandon16 wrote:
This is the datastep
proc sql;
create table test.testing as select
distinct cmonth,
contactnumber,
pf,
fymonth,
from newtest_all
group by cmonth;
This is VERY OBVIOUSLY NOT A DATA STEP! (its a proc sql that references another table we have zero information about, so it's of no value to us)
Post your example data in a data step with datalines, so we can recreate your data as is with a copy/paste and submit.
We have a datAset loaded into SAS and I have written a PROC SQL to bring back the variables I need. I'm not sure what else I can provide you as I don't create/load the dataset stored within SAS.
@RW9 has already provided you with the means to create a datastep from an existing dataset. Use it.
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.