I have top 3 month apps.with same name. want to add month next to the data. is it possible to add or merge two variables
apps count
pmf 34
pmf 23
pmf 12
expected
apps count
pmf (march) 34
pmf (feb) 23
pmf (jan) 12
@radha009 wrote:
I have top 3 month apps.with same name. want to add month next to the data. is it possible to add or merge two variables
Yes, it's possible. What are the rules though, how do you know the first is March and the last is January?
What have you tried so far?
Proc sql;
Create table work.Ent_L2_Apps as
SELECT Affected_CI, COUNT(Affected_CI) as count
FROM dash.Ent_L2_inc GROUP BY Affected_CI
HAVING COUNT (Affected_CI)=(
SELECT MAX(count)
FROM (
SELECT Affected_CI, COUNT(Affected_CI) as count
FROM dash.Ent_L2_inc
GROUP BY Affected_CI));
quit;
proc sql;
Create table work.Ent_L2_Apps1 as
SELECT Affected_CI, COUNT(Affected_CI) as count
FROM work.Ent_L2_prev GROUP BY Affected_CI
HAVING COUNT (Affected_CI)=(
SELECT MAX(count)
FROM (
SELECT Affected_CI, COUNT(Affected_CI) as count
FROM work.Ent_L2_prev
GROUP BY Affected_CI));
quit;
proc sql;
Create table work.Ent_L2_Apps2 as
SELECT Affected_CI, COUNT(Affected_CI) as count
FROM work.Ent_L2_old GROUP BY Affected_CI
HAVING COUNT (Affected_CI)=(
SELECT MAX(count)
FROM (
SELECT Affected_CI, COUNT(Affected_CI) as count
FROM work.Ent_L2_old
GROUP BY Affected_CI));
quit;
data dash.Ent_Top_apps;
set work.Ent_L2_Apps2(firstobs=1 obs=1) work.Ent_L2_Apps1 (firstobs=1 obs=1) work.Ent_L2_Apps (firstobs=1 obs=1);
run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.