BookmarkSubscribeRSS Feed
Piotr900k
Fluorite | Level 6

I need help to analyze the dependence of the objective function (variable: "cus12") on independent variables. I have data that has 1000 columns and the independent variables are divided into 4 groups: app_x, act_x, agr_x, ags_x. I probably need to write a loop to investigate the dependence of the variable "cus12" on variables from the given groups. I have a problem with writing such a loop and entering the appropriate "proc" in it.

I don't know how to start. My idea is as follows: 1. I think I should build a macro and a loop (but all the loops I build don't work). 2. I think I should parse the dependency using "proc logistic" but and don t have macro and loops so I can't try to do anything inside. 3. I wanted to use the Chi-Square and Cramer's V test, but without a good start, I can't try anything else. I am a beginner in SAS. Any help/advice will be useful. 

Can I give changing variables here? If yes, How?

proc freq data = my.credit;
tables ConstansVariable * variable_x / chisq;
output out= data cramv;
run;
I think about put this proc to loop but I don t know how...

2 REPLIES 2
Rick_SAS
SAS Super FREQ

1. Show us some sample data. No need for 1000 dependent variables, but please provide 8 or 12 (two or three sets of 4) so we can see the structure of the names. Do the groups of four have a common prefix or suffix?

 

2. Cramer's V is a measure of association between nominal variables. As you indicate, it is produced by PROC FREQ when you use the CHISQ option on the TABLES statement.

 

3. What do you intend to do with these 250 Cramer V statistics after you have estimated them? Presumably, you are not going to look at 250 tables on the screen.

Piotr900k
Fluorite | Level 6

Now i have something like that. (I don t know if it's ok)
%macro crammer_num;
%do i=1 %to %sysfunc(countw(&num_name_list));
%let next_name=%scan(&num_name
list,&i);
data zm
&next_name;
set &zbior(keep= &fun &next
name);
run;
proc freq data=zm
&next_name noprint; tables &fun*&nextname/chisq;
output out=vcram
&nextname cramv;
run;
data vcram
&nextname;
set vcram
&next_name;
zmienna ="&next
name";
vcram = abs(cramv);
run;
data vcram;
set vcram vcram
&next_name;
run;
%end;
%mend crammer_num;

%crammer_num;

Part of data in file.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1953 views
  • 0 likes
  • 2 in conversation