DATA Step, Macro, Functions and more

Transpose and summarizing data with SAS SQL

Accepted Solution Solved
Reply
Contributor
Posts: 36
Accepted Solution

Transpose and summarizing data with SAS SQL

I have the following table:

IDTypeRatio
4106CR1.4
4106IC2
4812CR1.3
5287IC5
7011CR1
7011IC1.5
7011TNW2.5
7849FC0.6
10261FC1
11057TNW0.75
11178CR1.5
11178IC3.75
11178TNW1.1
11452FC1.75

 

How do I summarize the data so I have one row per ID (want table).

IDCRICTNWFC
41061.42  
48121.3   
5287 5  
701111.52.5 
7849   0.6
10261   1
11057  0.75 
111781.53.751.1 
11452   1.75

Accepted Solutions
Solution
‎01-15-2017 05:18 PM
PROC Star
Posts: 7,467

Re: Transpose and summarizing data with SAS SQL

Posted in reply to Agent1592

Do you need to do it using proc sql? Proc transpose was made for such tasks:

 

proc transpose data=have out=want (drop=_Smiley Happy;
  by id;
  id type;
  var ratio;
run;

 

HTH,

Art, CEO, AnalystFinder.com

 

View solution in original post


All Replies
Solution
‎01-15-2017 05:18 PM
PROC Star
Posts: 7,467

Re: Transpose and summarizing data with SAS SQL

Posted in reply to Agent1592

Do you need to do it using proc sql? Proc transpose was made for such tasks:

 

proc transpose data=have out=want (drop=_Smiley Happy;
  by id;
  id type;
  var ratio;
run;

 

HTH,

Art, CEO, AnalystFinder.com

 

Contributor
Posts: 36

Re: Transpose and summarizing data with SAS SQL

Thank you art.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 187 views
  • 1 like
  • 2 in conversation