Hi All,
My data look like below format . I need col value in two variable , N & pct.
have:
id col
100 239 ( 34.5)
101 67 (100.0)
103 0
104 8 ( 6.9)
105 58 ( 5.2)
want:
id col n pct
100 239 ( 34.5) 239 34.5
101 67 (100.0) 67 100.0
103 0 0
104 8 ( 6.9) 8 6.9
105 58 ( 5.2) 58 5.2
Thanks
Cathy
Use the Scan function, but you might need or want to account for cases where it's 0.
n=scan(original_var, 1, "(");
pct=scan(original_var, 2, "(");
Use the Scan function, but you might need or want to account for cases where it's 0.
n=scan(original_var, 1, "(");
pct=scan(original_var, 2, "(");
Thanks reeza!!!
but i tweaked little bit
pct=scan(original_var, 2, "()");
Thanks
Cathy
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.