BookmarkSubscribeRSS Feed
bikash1207
Calcite | Level 5

Hi,

 

I have below table:

MonthTypeCountValue1Value2Value3Value4
01. AprilAuto73827.632.788.119.01
01. AprilVoluntary22110.0510.662.433.33
02. MayAuto2618.036.552.882.8
02. MayVoluntary1084.144.431.21.64
03. JuneAuto1735.9931.911.86
03. JuneVoluntary1205.4600.130.18

 

I want to convert it to:

 01. April01. April02. May02. May03. June03. June
 AutoVoluntaryAutoVoluntaryAutoVoluntary
Count738221261108173120
Value127.610.058.034.145.995.46
Value232.7810.666.554.4330
Value38.112.432.881.201.910.13
Value49.013.332.801.641.860.18

Please help.

2 REPLIES 2
Kurt_Bremser
Super User

Please supply example data in usable form (data step with datalines), so we can see exactly (in terms of types and other variable attributes) what we are dealing with.

Is your expected result a dataset or a report? Mind that you can't group variables like that in a dataset.

PGStats
Opal | Level 21

You could use proc tabulate:

 

 

data have;
input Month :&$12.  Type :$12.    Count   Value1  Value2  Value3  Value4;
datalines;
01. April   Auto    738 27.6    32.78   8.11    9.01
01. April   Voluntary   221 10.05   10.66   2.43    3.33
02. May     Auto    261 8.03    6.55    2.88    2.8
02. May     Voluntary   108 4.14    4.43    1.2 1.64
03. June    Auto    173 5.99    3   1.91    1.86
03. June    Voluntary   120 5.46    0   0.13    0.18
;

proc tabulate data=have;
class month type;
var Count Value1 Value2 Value3 Value4;
table (Count*format=6.0 Value1 Value2 Value3 Value4), month=""*type=""*max="";
run;

Capture.PNG

 

PG

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 913 views
  • 1 like
  • 3 in conversation