DATA Step, Macro, Functions and more

add month to the cell data

Reply
Contributor
Posts: 70

add month to the cell data

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

Super User
Posts: 24,026

Re: add month to the cell data


@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?

 

Spoiler

@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

 

apps count

pmf    34

pmf    23

pmf    12

 

expected

 

apps           count

pmf (march)   34

pmf (feb)        23

pmf (jan)         12


Contributor
Posts: 70

Re: add month to the cell data

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;

Ask a Question
Discussion stats
  • 2 replies
  • 134 views
  • 0 likes
  • 2 in conversation