Dears,
I have a dataset with data on pharmaceutical supplies with around 7million observations. One of the variables is on the pharmaceutical presentation, and I have around 1200 different types of presentations. I want to go from the pharmaceutical presentation to the total amount of substance per box
The variable is in string as follows and I want to multiply the first number (amount of substance per pill) per the number in the end of the string (number of pills in a box)
40 MG COM REV CT BL AL PLAS TRANS X 10
40 MG COM REV CT BL AL PLAS TRANS X 20
40 MG COM REV CT BL AL PLAS TRANS X 30
5 MG COM CT 2 BL AL PLAS INC X 10
5 MG COM CT BL AL / AL X 20
5 MG COM CT BL AL / AL X 30
5 MG COM CT BL AL PLAS BCO LEIT X 20
5 MG COM CT BL AL PLAS INC X 100
5 MG COM CT BL AL PLAS INC X 20
5 MG COM CT BL AL PLAS INC X 20
5 MG COM CT BL AL PLAS INC X 30
5 MG COM CT BL AL PLAS OPC X 20
5 MG COM CT BL AL PLAS OPC X 30
Problem 2: some of thee strings (less than 10%) have information in parenthesis that do not interest me in the end, i.e:
20 MG COM DISP CT 2 BL AL PLAS INC X 14 (PORT 344/98 L - C1)
25 MG CAP GEL DURA CT BL AL PLAS INC X 50 (EMB HOSP)
Do you have any suggestions on how to solve it?
Thanks so much
Related Posts with Mathematical operations within a string variable
Keep multiple observations in a variableDear Statalist I have a dataset that include 179 countries. However, i only want to keep 51 of them…
Displaying Percent and Rawpercent Statistics as columns using table with multiple subgroupsHi all, Not sure if I've describe the problem properly in the title, but I've been trying to learn …
Interpreting MCA predict rowscoresDear Stata users, I have a question regarding the interpretation of the variable created from using…
variable RR already defined variable Lower not found error during Mantel–Haenszel estimate of the rate ratioHello everyone, I hope you're all doing fine. Firstly, I wanted to express how grateful am I for you…
Highlight lines on spaghetti plotHello, I am working with the following dataset. Code: * Example generated by -dataex-. To install:…
Subscribe to:
Post Comments (Atom)
0 Response to Mathematical operations within a string variable
Post a Comment