Import a sas7bdat file into SAS Studio

Accepted Solution Solved
Reply
Regular Contributor
Posts: 199
Accepted Solution

Import a sas7bdat file into SAS Studio

I am a total newbie. Thanks in advance for your mercy.

I am looking for the step to import a sas7bdat file into SAS Studio.

Thanks!


Accepted Solutions
Solution
‎03-02-2015 10:49 AM
Super User
Super User
Posts: 6,347

Re: Import a sas7bdat file into SAS Studio

Libnames point to the folder that contain the datasets not the individual datasets.  You can then reference the datasets by using the LIBREF and the member name.

libname mydata "/home/username/MyData" ;

proc print data=mydata.hivdat ;

run;

In addition to the traditional LIBREF.MEMNAME syntax you can also reference the physical file name by enclosing it it quotes.

proc print data="/home/username/MyData/hivdat.sas7bdat";

run;

View solution in original post


All Replies
Grand Advisor
Posts: 17,356

Re: Import a sas7bdat file into SAS Studio

Try the tutorials and the Help Centre.

Make sure to set up your shared folder and have the file under folders/myfolders/your_sas_file.sas7bdat

libname myfiles '/folders/myfolders/';

proc print data=myfiles.your_sas_file;

run;

FAQ:

SAS University Edition Help Center

See the section regarding using your own data.

Youtube Tutorials:

SAS Analytics U - YouTube

Regular Contributor
Posts: 199

Re: Import a sas7bdat file into SAS Studio

The procedure for SAS Studio is different. Here's the step that works for an Excel file:

LIBNAME mylib "/home/username/MyData/PH 627/";


filename PH627 "/home/username/MyData/PH 627/SBPdata.xls";

run;


proc import DATAFILE="/home/username/MyData/PH 627/SBPdata.xls"

  DBMS=xls

  OUT=mylib.PH627;

run;

Grand Advisor
Posts: 17,356

Re: Import a sas7bdat file into SAS Studio

Ok...I should have asked for clarification.I assumed you were using SAS University Edition, but it sounds like you're using SAS On Demand for Academics instead?

You've posted code for an excel file while your original question was for a SAS file, .sas7bdat? Is your question answered or do you still need help?

There are some good posts on here from Cynthia Zender with how to load data to SAS On Demand.

Regular Contributor
Posts: 199

Re: Import a sas7bdat file into SAS Studio

I do still need help. Thanks!

I'm using SAS Studio, which is like SAS UE and SAS OD for Academics. It's browser-based.

I posted the program for the Excel file as an example. I am trying to read/import (not sure the proper terminology) a .sas7bdat file.

I'll check Cynthia Zender's posts. Thanks for helping.

Respected Advisor
Posts: 3,063

Re: Import a sas7bdat file into SAS Studio

Welcome to the SAS community. When wanting help with some code you have written that is giving errors or is not working how you want, it is a good idea to post the SAS log of your code with your question.

This tends to cut through your difficulty in correctly describing your problem and in us understanding it.

BTW SAS Studio is just another way of writing and running SAS code - the same code you would run with any other SAS interface.

Esteemed Advisor
Posts: 6,661

Re: Import a sas7bdat file into SAS Studio

A .sas7bdat file does NOT need to be imported, it already is a SAS dataset. You need to place it in a location that your SAS process can see, and assign a libname to that location.

SAS/Studio is just a web-based frontend for SAS, and can be run in a multitude of configurations.

So the questions are:

- What is the backend for your SAS Studio (SAS on Demand, SAS UE or your organization's licensed SAS environment)?

- If the latter, do you have a single machine install with local SAS or a client/server setup without SAS software installed locally on your PC?

- If installed on a server, which operating system does the server run on?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Regular Contributor
Posts: 199

Re: Import a sas7bdat file into SAS Studio

Here is my current program and the log. I've removed the IMPORT statement based on your comment that the file does not need to be imported:


"LIBNAME mylib "/home/username/MyData/SAS Class";

filename assign7 "/home/username/MyData/hivdat.sas7bdat";

run;

proc print;

run;"

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

57 

58 proc print;

ERROR: There is not a default input data set (_LAST_ is _NULL_).

59 run;

Regular Contributor
Posts: 199

Re: Import a sas7bdat file into SAS Studio

<What is the backend for your SAS Studio (SAS on Demand, SAS UE or your organization's licensed SAS environment)?>

I don't know. I am not using SAS UE or my organizations SAS environment. I simply registered on the site and started using the free app.

The files must be uploaded before they can be used. I cannot point to a file on my hard drive.

Occasional Contributor
Posts: 9

Re: Import a sas7bdat file into SAS Studio

Hi ,

Open SAS studio on demand in any internet explorer.

At the left hand side,click on Click on 'Server files and folders'.

Once opened,then click on 'files(Home)' .

After clikcing over it, click on upload icon little above .

A windows pop-up will open.In this pop-up,click on choose files.

This will then get connected to your desktop,and thus you can upload the files in SAS studio usingthis.

 

sorry, do not have screenshot access in the office, else would have shared screenshot as well.

Reply to me ,if you need any help.

Happy learning.

Solution
‎03-02-2015 10:49 AM
Super User
Super User
Posts: 6,347

Re: Import a sas7bdat file into SAS Studio

Libnames point to the folder that contain the datasets not the individual datasets.  You can then reference the datasets by using the LIBREF and the member name.

libname mydata "/home/username/MyData" ;

proc print data=mydata.hivdat ;

run;

In addition to the traditional LIBREF.MEMNAME syntax you can also reference the physical file name by enclosing it it quotes.

proc print data="/home/username/MyData/hivdat.sas7bdat";

run;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 10 replies
  • 14242 views
  • 9 likes
  • 6 in conversation