I have an excel sheet which i have drew below and i need to create the values for coloumn C
and the formula is
=IF($A2="Pricing", IF($B2>=0, IF(LEN($B2)=1, "+00"&$ B2, IF(LEN($B2)=2, "+0"&$ B2, IF(LEN($B2)=3, "+"&$ B2))), IF(LEN($B2)=2, "-00"&ABS($B2), IF(LEN($B2)=3, "-0"&ABS($B2), IF(LEN($B2)=4, "-"&ABS($B2))))),"")
Can anyone convert this code to SAS code so that the values in coloumn C would be
Hmm...as usual @FreelanceReinh is correct 🙂
But, my suggestion would be to build your own custom format and keep it as a numeric value rather than convert it to a character variable. I would still emphasize that you should know what your formula's are doing, always.
Z3 - states a length of 3
Z4 - states a length of 4
If your case is different than what you've initially presented you need to explain in detail how and what you want.
If your values are numeric a simple custom format will do this. If your values aren't numeric then why not?
proc format library=work; picture Mysign low - < 0 = '0999' (prefix='-') 0 - high = '0999' (prefix='+') ; run; data junk; do x = -99,-39,-9,0,39,14, 999; output; end; run; proc print data=junk noobs; format x Mysign.; run;
if you need to display larger values add more 9 to the '0999' in the format, the 0 is there for a placeholder to put the + or - into.
If you need decimals then '0999.99' or similar.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.