data mydata;
infile datalines;
input list $ NDC discount;
datalines;
Nov 11 50
Dec 12 20
Nov 11 50
May 12 .
Mar 11 30
;
run; My data looks like this list NDC discount Nov 11 50
Dec 12 20
Nov 11 50
May 12 .
Mar 11 30 And I want it to look like this: list ProductServiceID NDC discount Count_of_NDC
Dec 12 12 20 1
Mar 11 11 30 1
Nov 11 11 50 2 That is, I want to create a count of NDC as well as create a new variable called ProductServiceID that is equal to NDC. This Proc Sql will accomplish this: proc sql;
create table mydata2 as
select list,
NDC as ProductServiceID,
NDC,
discount,
count(NDC) as Count_of_NDC
from mydata
where discount ne .
group by list,NDC,discount;
quit; However, I want to do it using proc means or data step or a combination of the two. Please help.
... View more