BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
_maldini_
Barite | Level 11

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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

10 REPLIES 10
Reeza
Super User

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

_maldini_
Barite | Level 11

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;

Reeza
Super User

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.

_maldini_
Barite | Level 11

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.

SASKiwi
PROC Star

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.

Kurt_Bremser
Super User

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?

_maldini_
Barite | Level 11

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;

_maldini_
Barite | Level 11

<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.

thisisneeraj
Fluorite | Level 6

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.

Tom
Super User Tom
Super User

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;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 10 replies
  • 70482 views
  • 13 likes
  • 6 in conversation