BookmarkSubscribeRSS Feed
Brandon16
Obsidian | Level 7

Hi,

 

How do I change my tabulate from looking like this.....

 

 CountPercent 
PFFYMonth1200.946
ADec-17  
 Jan-185418
 Nov-1727
 Oct-17618
BDec-1720.327
 Jan-18228
 Nov-172761
 Oct-1727
CDec-1728
 Jan-181523.491
 Nov-1717
 Oct-17599
DDec-17418
 Jan-1828
 Nov-1710.046
 Oct-1748
EDec-1768
 Jan-18184
 Nov-17384
 Oct-17480.033

 

To this.......

 

 CountPercent 
PFFYMonth1200.946
ADec-17  
AJan-185418
ANov-1727
AOct-17618
BDec-1720.327
BJan-18228
BNov-172761
BOct-1727
CDec-1728
CJan-181523.491
CNov-1717
COct-17599
DDec-17418
DJan-1828
DNov-1710.046
DOct-1748
EDec-1768
EJan-18184
ENov-17384
EOct-17480.033
9 REPLIES 9
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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".

Brandon16
Obsidian | Level 7
The problem is I am encountering these issues as the code develops so hard to foresee at the time what Is needed. Each post is at the time of a problem and as I am learning, I don't know what issue I will face next, hence the multiple threads.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Brandon16
Obsidian | Level 7

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;

Brandon16
Obsidian | Level 7

This is the datastep

 

proc sql;
create table test.testing as select
distinct cmonth,
contactnumber,
pf,
fymonth,
from newtest_all
group by cmonth;

Kurt_Bremser
Super User

@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.

Brandon16
Obsidian | Level 7

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. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 9 replies
  • 976 views
  • 0 likes
  • 3 in conversation