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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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