Programming the statistical procedures from SAS

PROC CORR on subset of data

Accepted Solution Solved
Reply
Contributor
Posts: 69
Accepted Solution

PROC CORR on subset of data

[ Edited ]

Hello

 

I have a simple code for proc corr:

proc corr data=sasuser.sasfile190616;

var TAssets Sales ROA Q SalesGro RDSales LTassets;

by FF;

run

 

I want that this procedure will run only for these lines that FF=1. Where I have to add this condition?

 

Thanks a lot!

 


Accepted Solutions
Solution
‎06-20-2016 01:49 AM
Grand Advisor
Posts: 16,875

Re: PROC CORR

You can filter your data with a WHERE clause.

 

This can be placed in your code, I generally recommend it goes right after the PROC CORR statement. 

 

WHERE FF=1;

The full code is below, but if you're running it for only one value of FF, then you don't need the BY statement. In general I find its best to include the BY as early as possible in the proc. 

proc corr data=sasuser.sasfile190616;
Where FF=1;
by FF;
var TAssets Sales ROA Q SalesGro RDSales LTassets;
run

View solution in original post


All Replies
Solution
‎06-20-2016 01:49 AM
Grand Advisor
Posts: 16,875

Re: PROC CORR

You can filter your data with a WHERE clause.

 

This can be placed in your code, I generally recommend it goes right after the PROC CORR statement. 

 

WHERE FF=1;

The full code is below, but if you're running it for only one value of FF, then you don't need the BY statement. In general I find its best to include the BY as early as possible in the proc. 

proc corr data=sasuser.sasfile190616;
Where FF=1;
by FF;
var TAssets Sales ROA Q SalesGro RDSales LTassets;
run
Contributor
Posts: 69

Re: PROC CORR

Thanks for your reply.

 

☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 185 views
  • 2 likes
  • 2 in conversation