BookmarkSubscribeRSS Feed
gretaolsson
Calcite | Level 5
Hello,

I want to analyze simulated data of different sizes in both R and SAS. 
I have simulated all the samples in R and where I've done all my analysis, now I want to analyze
all of those samples in SAS. All samples are in a the data frame.
I want to do logistic regression and exact logistic regression,
and I'm interested in the estimated coefficients. (university edition) 1. How do I transfer all samples to SAS smoothly? (So that point 2 gets easy) 2. How do I make a loop so that I can analyze all the data directly?
Note that the sample size goes from 5-1500 with an increment of 5 and for now I
only have one explanatory variable.

Plz help :)
2 REPLIES 2
user24feb
Barite | Level 11

1. One easy way would be a csv-file (write.csv, .. in R & proc import in SAS). (And you could simulate your data in SAS as well (?))

2. Depending on your models and data there are different ways too. Check out the "BY" Statement of proc logistic.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

 

There are R packages to create datasets directly for example:

https://cran.r-project.org/web/packages/sas7bdat/sas7bdat.pdf

 

Then you simply copy that file to your working area and write code based on that dataset.

AS for your stats question, I don't know the code offhand, but "looping" is done using by group processing.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 705 views
  • 0 likes
  • 3 in conversation