Data restructuring

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

wadderus
Posts: 3
Joined: Tue Feb 23, 2016 5:25 pm

Data restructuring

Postby wadderus » Fri Jul 15, 2016 11:37 am

Hi all
I am trying to restructure my data and any help will be really appreciated. I have no preferences regarding which software to use
In the original data I have the following variables Patient Id variable, a string variable that contains a drug name, drug received data, strength, repetition, patient age...etc
Example
Patient ID-- Drug name----received date--strength
1------------Cefrriaxone----1/1/2016--------500
1------------Cefrriaxone----2/1/2016--------500
2------------Cefaclor--------5/6/2016--------1000
2------------Cefaclor--------6/6/2016--------1000
And I wanted restructure the data by transforming each different drug name in the drug name variable to a new variable and transform the date to starting date and discontinuation date (1st and last recieved date for each drug for each patient). so the data would look like this
ID---Ceftri--st.date---disc.date--dose--cefaclor---st.date2--disc.date2---dose2
1-----1------1/1/16----2/1/16----500----2---------n/a---------n/a----------n/a
2-----2-------n/a--------n/a-------n/a----1---------5/6/16-----6/6/16------1000
Thanks

Who is online

Users browsing this forum: No registered users and 1 guest

cron