Hello everyone,
I'm new to SAS but I have been using R for imputation of missing variables using MICE. I have generated my imputed datasets in R and used propensity score matching after imputations to match the data and generated Kaplan Meier survival data and HRs for each dataset. Now I want to combine the results from these imputed datasets, but R doesn't have any packages that will allow that as far I can tell, however, I did find this paper that describes how to do that in SAS using the MIANALYZE Procedure:
https://www.pharmasug.org/proceedings/2017/SP/PharmaSUG-2017-SP05.pdf
Is there a way for me to lets say import a csv file into SAS to create an input dataset that would be compatible with the MIANALYZE Procedure and run the code as described in the previous article? If so, please provide some instructions on how I can do that.
Thank you
If you have the data in a CSV file you can read the data into a SAS data set using either proc import, which makes some guesses as to variable properties based on the content.
Example code:
proc import datafile="C:\My Documents\myfiles\delimiter.csv" dbms=dlm out=mydata replace ; delimiter=','; getnames=yes; guessingrows = max; run;
The procedure will generate data step code that you can copy from the log and modify if something isn't quite right.
If you have two different CSV files with the same structure, or common variables, that you will want to combine later you should either verify that the created common variables have all of the same properties, (basically the INFORMAT statement for the variable).
If not you may want to modify both data step code sections to provide common properties.
The data set should at least run with MIANALYZE but if the content is not a simple row/column layout with each column intended to be a single variable then that is another question on how to read a more complex file layout.
Questions about combining datasets are frequent topics here so don't hesitate to ask when you get to that part though the Data step MERGE or a Proc SQL block are the two most likely approaches depending on needs.
I'm curious if you got this to work. I have the same question. I need to use the R package called SANON. I can get all the imputed data sets into SANON. With a loop, SANON will output the estimate and SE for each data set. How do I format the output data to read into MIANALYZE?
If you can create a SAS data set from the output and post a portion of it here, then I can help you get it into the exact format that MIANALYZE can use. It should be sufficient to simply post a Proc PRINT of the 1st 10 observations or so in the data set so that I can get the gist of the format.
@Alan68022 wrote:
I'm curious if you got this to work. I have the same question. I need to use the R package called SANON. I can get all the imputed data sets into SANON. With a loop, SANON will output the estimate and SE for each data set. How do I format the output data to read into MIANALYZE?
Apparently the original poster that started this thread has not posted any activity on the forum for more than five years now.
I would suggest starting your own thread and provide some details, such as providing versions of YOUR data files or sets.
Also, as thread creator you have the ability to mark answers as correct.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.