BookmarkSubscribeRSS Feed
msantosp
Fluorite | Level 6

Dear all,

 

I am beginner in SAS and I am developing a program in which I have to use parameters from a raw_table to compute another variable. 

 

I mean, I have the table "parametros" and my aim is to calculate for each mod_id the formula below:

 

new_score= Par_A*raw_score + Par_B + (Par_C+Par_D)/raw_score

 

I do not how to select values from parametros to use in the code below.

 

Can anybody help me? Thank you in advance



data parametros;                    
   input mod_id Par_A Par_B Par_C Par_D; 
   datalines;         
	8 1.5340 -0.6896 0.0214 0.0211
	9 0.6560 -0.7788 0.0169 0.0185
	10 1.8773 -0.4354 0.0216 0.0227
	11 0.8543 -0.8598 0.0258 0.0269
	12 -0.5137 -0.9571 0.0213 0.0231
	13 0.0979 -0.9629 0.0239 0.0258
	14 0.8889 -0.7801 0.0136 0.0146
run;                           


data mapping_table;
mod_id=8;
Do while (mod_id<15);
	raw_score=1600;
	Do while (raw_score<2201);
	new_score= Par_A*raw_score + Par_B + (Par_C+Par_D)/raw_score;	
output; raw_score+1; end; mod_id + 1; end; run;
1 REPLY 1
gamotte
Rhodochrosite | Level 12

Hello,

 

Use the set statement to read the parametros dataset row by row.

 

data mapping_table;
    set parametros;
    do raw_score=1600 to 2200;
        new_score= Par_A*raw_score + Par_B + (Par_C+Par_D)/raw_score;	
        output;
    end;
run;

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 291 views
  • 0 likes
  • 2 in conversation