BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cathy_sas
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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, "(");

View solution in original post

2 REPLIES 2
Reeza
Super User

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, "(");

cathy_sas
Calcite | Level 5

Thanks reeza!!!

but i tweaked little bit

pct=scan(original_var, 2, "()");

Thanks

Cathy

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 828 views
  • 0 likes
  • 2 in conversation