Learning SAS? Welcome to the exclusive online community for all SAS learners.

How to use the data statement in SAS online.

Reply
New Contributor
Posts: 2

How to use the data statement in SAS online.

I am having some issues to run simple models such as a prog reg or more complex models suchas as prox mixed.

I don't have problems to open my database and run proc means. But I do have problems with those proc that use data=xxxx. For example:

import mydata "/home/evillalo/HP/famcohesion2.sas7bdat";

options nofmterr;

data "/home/evillalo/HP/hp";

set "/home/evillalo/HP/famcohesion2.sas7bdat";

run;

PROC MIXED data=xxx covtest noclprint method = ML;

class d1race1 c3gender p1inc03 d1hheduc;

repeated id;

model ql=d1race1 c3gender factor1 factor2 factor3 p1inc03 d1hheduc /SOLUTION OUTPRED=predicted;

random intercept factor1 / SOLUTION;

run;

What should I use to be able to run the model? Which part should I use after the data statement?

Thanks so much!

Super User
Posts: 19,878

Re: How to use the data statement in SAS online.

It looks like you have SAS datasets, so you can create a library to reference the folder and then use the dataset name.

Although you can technically reference a dataset directly with the path, it makes it hard to read.

*create a lib name reference to sas files;

libname evi '/home/evillalo/HP';

*creates a copy of the dataset, not sure why?;

data hp.hp;

set hp.famcohesion2;

run;

*reference created file;

proc mixed data=hp.hp covtest noclprint method=ML;

....remaining code

run;

OR

proc mixed data=hp.famcohesion2 etc...

Super User
Posts: 7,868

Re: How to use the data statement in SAS online.

data=xxx simply means 'use dataset XXX in library WORK as input dataset'. WORK is implied automatically, since no specific library was given.

What is your problem (post log!)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 12

Re: How to use the data statement in SAS online.

Hello

  Reeza's example will work with the exception of changing the references to...

libname evi '/home/evillalo/HP';

*creates a copy of the dataset, not sure why?;

data famcohesion2;

set evi.famcohesion2;

run;

/*********************************************************************************/

/* dataset famcohesion2  now exist in WORK                                    */

/*********************************************************************************/

*reference created file;

proc mixed data=famcohesion2 covtest noclprint method=ML;

....remaining code

run;

OR

proc mixed data=evi.famcohesion2 etc..

That is if library '/home/evillalo/HP' does exist with member famcohesion2.

SAS Super FREQ
Posts: 8,869

Re: How to use the data statement in SAS online.

Hi:

  

  And here's a tip.... If you are using SAS OnDemand for Academics, you can ALWAYS click on the file name in your "My Folders" location in SAS Studio (for example) and right-click to see the Properties. The correct path location will be shown in the popup window.

cynthia

SAS Super FREQ
Posts: 8,869

Re: How to use the data statement in SAS online.

Posted in reply to Cynthia_sas

Posting a picture of the Properties:

general_soda_path.png

Ask a Question
Discussion stats
  • 5 replies
  • 391 views
  • 0 likes
  • 5 in conversation