Thanks!
You were right. It was redundant. I redid with more thought and didn't need to create any hashes or arrays. I was just making things much harder than necessary.
Sorry and thanx a lot
~klkot
Okay thanks Kevin
So I created it how *I think* it should look but there's something wrong with the way I've created the hash. Do you know what I've done wrong? Here's my whole code:
open(FH ,"/home/kotterkl/nsqipfakedata")||die "Couldn't open infile";
open(OUTFILE...
Hi again Perl gurus
I've created the following Perl script to generate groups of test (T) and development (D) or "treatment and control" with the flip of a coin so to speak divided according to a list of a fake case Id's. So the first perl script I've written to do the simple task of:
fakeid...
Thanks prex1.
I managed to use kevin's first code and it seemed to work but I see yours is very good and advanced (maybe a little too advanced for me;)
Thanks as well prex1
~klkot
Thanks Kevin
I hope you win for Perl-meister of the week so I gave you a star! You make hard things easy and you've been a great help so far. I might have to post again if I can't get it to go through properly tomorrow but it looks like it'll work
Cheers Kevin ;)
klkot
I know patientid should go from 1101-1241 consecutively but there happen to be missing observations for patientid in the actual dataset. I want to add the missing rows.
Thanks Kevin!
Hi again Perl gurus.
I've used the following code which produces the output I want where patientid is the key and each file has three values so the output looks like:
Patientid Var1File1 Var2File1 Var3File1 Var1File2......
1200 val val val val
1203 val...
Hi again Miller
Yeah I fixed it with conditionals. They set up the code so that when you sum things, even if you're summing all nils, it sums 0. I'm realizing that is just another sort of frustrating thing that Perl does that you have to go over with with conditionals to fix :(
Using a function such as the one below causes the issue of assuming that if all the intdaymiss i's were nil (missing), it manages to calculate the sum to be 0 rather than nil. Do you know what to do to make sure it sums all nils to stay nil?
$megahash{$patientid[$i]}{$filename}[$dmindx] +=...
Miller and Kevin
What can I say other than: you people ROCK! Thanks for the valuable advice. Both of your codes have helped me form my solution. If you want to see my final solution I would be happy to show you...
Can't thank you enough!
~klkot
two stars for the two of you :)
Hey
I thanked Miller for giving a helpful post. He/she was right. I gave a star or whatever to thank Miller. And sorry I didn't say anything about your post Kevin but I wasn't looking for the output you gave in your code. The output I wanted was one patient id PER row and I finally figured...
The following file I created works to create the dataset I want for each file individually. I would have loaded each file and the two separate datasets would come out like this:
Medication 1 Dataset
Patientid Adhash{patientid}
1223 .95
1224 .56
1225 .78
1226 .99...
Thanks Miller. I used the == but it still was not able to print the adhash. Does anyone know the code to make the output print in the form I want it to?
I really appreciate it any advice ;)
I'm very new to Perl and trying to get things to work. I'm working with a dataset that originally looks like this:
ID Intdaymiss Daysobs
2611 . 12
2611 5 28
2612 . 0
2613 0 .
2613 5...
Just looked at Perl for the first time this week. Originally a SAS programmer so trying to translate sas code that worked into perl code for data management. This is sort of complicated so wondering how I might fix the errors?
Thanks!
I put the following code in and it does not work. Steps I...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.