hi thank u for reading this:
i have variable ticker
ticker
aapl
a
goog.
kld.
aa.
b.
i want to remove the . after goog, kld, aa, and b.
could you help?
thank you!!!
You can remove all of the periods (even those not at the end of the string) by using the COMPRESS() function.
A= compress(A,'.');
You can remove all of the periods (even those not at the end of the string) by using the COMPRESS() function.
A= compress(A,'.');
tom, thank you very much for your kind help.
i have one more question that i believe you have an answer to:
my data looks like this
yr name strength_a strength_b strength_c strength_d class
1991 john 2 1 0 0 a
1991 amy 1 0 2 1 a
1991 ted 0 2 1 1 b
1991 tom 2 2 0 0 b
1992 john 2 1 0 0 a
1992 amy 1 0 2 1 a
1992 ted 0 2 1 1 b
1992 tom 2 2 0 0 b
my years are from 1991 to 2012 and i have more observations than the above but i just wanted to give you a picture. my scores range from 0~2.
I want to arrive at the format below:
Yr name varname score class
1991 john strength_a 2 a
1991 john strength_b 1 a
1991 john strength_c 0 a
1991 john strength_d 0 a
1991 amy strength_a 1 a
1991 amy strength_b 0 a
1991 amy strength_c 2 a
1991 amy strength_d 1 a
Could you kindly provde me of your guidance?
That looks like a PROC TRANSPOSE to me.
You will need to sort the data first.
proc transpose data=have out=want prefix=score ;
by yr name class ;
var strength_: ;
run;
tom, this is magic. thank you so much!
what if my data looks like the 1st table below and wanted to arrive at the 2nd table? i tried to apply ur logic but it is not working for some reason. it is spitting out 100s of score: score1, score2,..... thank you!
year | name | one_str_a | one_str_b | one_str_c | one_con_a | one_con_b | one_con_c | two_str_a | two_str_b | two_str_c | two_con_a | two_con_b | two_con_c |
1991 | john | 2 | 1 | 1 | 1 | 1 | 2 | 1 | 1 | 1 | 1 | 2 | 1 |
1991 | amy | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 |
1991 | ted | 2 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 1 | 1 | 2 | 1 |
1991 | tom | 1 | 2 | 0 | 2 | 0 | 1 | 0 | 2 | 0 | 0 | 1 | 0 |
1992 | john | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
1992 | amy | 0 | 2 | 2 | 2 | 2 | 0 | 2 | 2 | 2 | 2 | 0 | 2 |
1992 | ted | 2 | 1 | 1 | 1 | 1 | 2 | 1 | 1 | 1 | 1 | 2 | 1 |
1992 | tom | 1 | 2 | 2 | 2 | 2 | 1 | 2 | 2 | 2 | 2 | 1 | 2 |
varname | Score | ||||||||||||
1991 | john | one_str_a | 2 | ||||||||||
1991 | john | one_str_b | 1 | ||||||||||
1991 | john | one_str_c | 1 | ||||||||||
1991 | john | one_con_a | 1 | ||||||||||
1991 | john | one_con_b | 1 | ||||||||||
1991 | john | one_con_c | 2 | ||||||||||
1991 | john | two_str_a | 1 | ||||||||||
1991 | john | two_str_b | 1 | ||||||||||
1991 | john | two_str_c | 1 | ||||||||||
1991 | john | two_con_a | 1 | ||||||||||
1991 | john | two_con_b | 2 | ||||||||||
1991 | john | two_con_c | 1 |
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.