BookmarkSubscribeRSS Feed
kubbo
Calcite | Level 5

Hi everyone,

 

I'm having an issue with proc summary in SAS 9.4. My code is:

 

proc summary data=project.new nway completetypes;
 class product_group product_id region district sales_channel status;
 var count premium age_policyholder_analysis_date_G duration_G;
 output out=project.test1
 sum(premium muzi zeny)=sum_premium muzi zeny
 mean(age_policyholder_analysis_date_G duration_G)=mean_age  mean_duration;
run;

I'm trying to create an "aggregation" but the problem is when using completetypes statement. I get combination of each variables - also combination of "region" and "district" variables which makes no sense because for example distrct "Bratislava" doesn't exist in region "Banskobystrický" (see attached screenshot).

 

But when I do not use completetypes statement I don't get missing sums (in district "Brezno" for example) which I need.

 

Is there a way to use some sort of regional hierarchy or something?

 

Thank you.


Capture.PNG
3 REPLIES 3
jklaverstijn
Rhodochrosite | Level 12

What about eliminating REGION from your summary? You can later join it back in by means of a lookup table or a format that maps regions to districts. Same could apply to the product_group-porduct_id hierarchy.

 

Hope this helps,

- Jan.

kubbo
Calcite | Level 5

Yes. It's interesting and simple solution. I'm working on it right now.

 

I really appreciate your help.

Reeza
Super User

If you need specific combinations you can use CLASSDATA to specify the levels you're interested in, using PROC MEANS. 

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!

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.

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