BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ed_sas_member
Meteorite | Level 14

Hi @Gretaku 

 

No panic, we are almost there 🙂

It comes from the fact that you use the same name for all your tables:

 

proc sql;
create table TMP.SAS_Zum_Tableau_aktualisierenBIS as
select *,
  year(date) as year,
  month(date) as month,
  avg(NPS_value) as monthly_avg
from TMP.SAS_ZUM_TABLEAU_AKTUALISIEREN
group by touchpoint_spec, month(date), year(date);
run;
 
/* average of value per month previous year */
 
proc sql;
create table TMP.SAS_Zum_Tableau_aktualisierenTER as
select distinct touchpoint_spec, year, month, monthly_avg
from TMP.SAS_Zum_Tableau_aktualisierenBIS;
quit;
 
proc sql;
create table TMP.SAS_Zum_Tableau_aktualisierenWANT as
select a.*, b.monthly_avg as monthly_avg_preyear
from TMP.SAS_Zum_Tableau_aktualisierenBIS as a left join TMP.SAS_Zum_Tableau_aktualisierenTER as b
on a.touchpoint_spec=b.touchpoint_spec and a.month = b.month and (a.year-1)=b.year
order by a.touchpoint_spec;
run;
Gretaku
Fluorite | Level 6

@ed_sas_member 

 

Thank you so much! I really appreciate your great support with this!!! 

 

Have a lovely weekend.

Best

Gretaku

ed_sas_member
Meteorite | Level 14

Awesome!

Thank you for your patience @Gretaku 

Have a lovely weekend too Smiley Happy

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
  • 17 replies
  • 3439 views
  • 3 likes
  • 2 in conversation