I have various values for different variables in mutiple rows and columns showing 0/2 or 0/3 or 0/4 and so on ..
I have a total of 7 columns depicting treatmentand they have values like "0/some numeral"
I was to assign these values a "0" value. Can anyone please tell me how do i do this?
I can try to use index but for multiple row and multiple column it is not reading.
Thankx for the responce. It is not the first position. i have 200 rows and 7 columns and these values come randomly as 0/some numeral.. So i do not know how to assign them in such scenario.
Show some example data and the desired result.
Thankx for reaching out.
The data looks like
trta_1 trta_2 trta_3 ,trtb_1 trtb_2 trtb_3 wher trta and trtb are different drugs
trta_1 and trta _2 are two different time points of the same drug.
trta_3 will be the sum of same drug at the different time point.
trta_1 trta_2 trta_3 trtb_1 trtb_2 trtb_3
1/5 0/5 1/5 7/5 0/5 7/5
Well, you don't tell us the names of the variables, so I will call them COL1 through COL7.
This is the way you would correct a single variable:
if col1 =: '0/' then co1='0';
This assumes that '0/' would appear at the beginning of the variable's value. If that's not the case, it can be done but becomes more complex.
To apply the same logic to all 7 variables, you would use an array:
array cols {7} col1-col7;
do _n_=1 to 7;
if cols{_n_} =: '0/' then cols{_n_} = '0';
end;
Good luck.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.