Search code examples
sasenterprise-guide

Run a PROC FREQ on var in dataset 1 computing correlations on a variable in dataset 2


I'm sorry if I'm asking a stupid question, I have some experience in R and am just starting to learn SAS. In enterprise guide I'm trying to compute a correlation matrix (cramv only) for categorical variables. The problem is that explanatory variables are on dataset1 while my objective variable is on dataset2. I cannot append the obj var column to dataset one for external reasons. Is there a way to perform the procedure without having to create another dataset?

Thank you in advance!

this is how I imagine it would work out:

ods output ChiSq=CRAMV; 
%put &charvar;
proc freq 
data= dataset1 dataset2
tables (&charvar) * (objvar) / chisq;
run;

Solution

  • SAS procedures only operate against a single dataset or view. If you didn't want to create another dataset then you could create a view that appends the objvar column to dataset one.

    Creating a view can be done with either proc sql; create view x as... or in a data step, data x / view=x...