BookmarkSubscribeRSS Feed
varmalh
Fluorite | Level 6

hi all,

can someone please advise how to get this question "BY USING ABOVE TABLES FIND OUT QUARTER WISE (QUARTER LIKE (FOR (JAN FEB MAR ) Q1, (JAN FEB MAR ) Q2,… and so on ) SEGEMENT WISE DISTINCT COUNT OF CUSTOMER AND THERE TOTAL_SPEND".....?

i have attached a screensort for the reference ......!

 

thanks and regards

varmalh

2 REPLIES 2
PGStats
Opal | Level 21

1) look up the definition of a quarter

2) look up function QTR() and format QTR.

3) try to at least write some code.

4) submit any question that arises to the Forum

 

in that order.

PG
varmalh
Fluorite | Level 6

Thanks PG,

I tried to write some codes and got stuck after 3 codes.

 

proc format;
value $mfmt "JAN","FEB","MAR"="Q1"
            "APR","MAY","JUN"="Q2"
            "JUL","AUG","SEP"="Q3"
            "OCT","NOV","DEC"="Q4";
run;
proc print data=customers ;
format month$mfmt.;
run;

data a;
set customers;
format month $mfmt.;
run;

proc sql;
create table j as select a.*,segment from a left join customer_seg on a.cust_id=customer_seg.cust_id;
quit;

please advise how to get the correct output.

 

Thanks

varmalh

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 360 views
  • 2 likes
  • 2 in conversation