DATA Step, Macro, Functions and more

How to use if statement inside the define in proc report

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 132
Accepted Solution

How to use if statement inside the define in proc report

Hi, 

I'm using proc report to produce a report and I need a way to count the number of "Y" in the column  

Site Approved (Y/N)
 
 
Y
 
Y
Y
 
 
 
 
 
 
 
Y
 
 
 
Y
Y
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Accepted Solutions
Solution
‎02-16-2018 02:40 PM
Respected Advisor
Posts: 2,660

Re: How to use if statement inside the define in proc report

Idea 1:

This could be done easily in a data step before PROC REPORT.

 

Idea 2:

If the value of the variable is 1 or 0, instead of Y or blank, then you could just sum up the columns in PROC REPORT

--
Paige Miller

View solution in original post


All Replies
Solution
‎02-16-2018 02:40 PM
Respected Advisor
Posts: 2,660

Re: How to use if statement inside the define in proc report

Idea 1:

This could be done easily in a data step before PROC REPORT.

 

Idea 2:

If the value of the variable is 1 or 0, instead of Y or blank, then you could just sum up the columns in PROC REPORT

--
Paige Miller
Frequent Contributor
Posts: 132

Re: How to use if statement inside the define in proc report

Posted in reply to PaigeMiller

I have same question I have dates in the columns and I need to count how many rows has dates on them I dont know how to use if stament to count one each time there is a date value 

Date Physical Submission Start Up Kit Sent to Site
 
 
 
6-Jun-17
28-Jul-17
12-May-17
 
 
6-Sep-17
 
 
 
 
 
 
 
 
 
8-Jun-17
 
13-Jul-17
 
N/A
 
 
 
 
 
 
 
 
 
 
 
 
23-May-17
 

 

Respected Advisor
Posts: 2,660

Re: How to use if statement inside the define in proc report

In a data step

 

if not missing(date) then count+1;
--
Paige Miller
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 114 views
  • 2 likes
  • 2 in conversation