i have a dataset example below
id visit_number date value test
1 2 2020-10-01 16:00 140 sodium
79 34 2011-07-10 09:15 . xray
in these columns id is a patient unique identifier, visit_number is a visit unique identifier, data: date of visit ; test - has up to 65 different test names (coded as numbers) and value is the result of the test.
few qs:
1. i want to creat a unique identifier combining id and visit number, say A B to AB
2. how can i create new variable columns from test using the test label using a foreach loop since there are 65 different variables in that column. i have created numeric labels for each test
many thanks, hal
Related Posts with Creating multiple new variable columns from an existing
appropriately deleting dummy 1sHi, I got a bit of a puzzle problem for one specific application, but I feel an appropriate solutio…
setting up drug coverage days using forv loophi, I ve been trying to setup "drug dose " for each day of follow up for a pharmacoepi analysis usin…
Adjust space between plots in "twoway ...., by(group)"I created two scatterplots and plotted them side by side, using "twoway (scatter y x), by(binary_gro…
Combining two variables by variables namesMy variables are: country (Angola, Armenia, Azerbaizan....) and year (2004, 2006, 2009). Is it possi…
Doubts on Diff-in-Diff methodDear Stata users, I am writing this post hoping that someone could help me. Here the story, I am a…
Subscribe to:
Post Comments (Atom)
0 Response to Creating multiple new variable columns from an existing
Post a Comment