Solved
Contributor
Posts: 21

# data btw brackets

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

Accepted Solutions
Solution
‎08-25-2015 11:23 PM
Super User
Posts: 23,776

## Re: data btw brackets

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

All Replies
Solution
‎08-25-2015 11:23 PM
Super User
Posts: 23,776

## Re: data btw brackets

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

Contributor
Posts: 21

## Re: data btw brackets

Thanks reeza!!!

but i tweaked little bit

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

Thanks

Cathy

🔒 This topic is solved and locked.

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