BookmarkSubscribeRSS Feed
jins
Fluorite | Level 6

Working on a script in SAS VIYA and want to refer a sas7bdat file stored under SAS Content > Public. Not sure how to find the path and I tried using FILESRVC option but it runs and the log says 1 observation and 0 variables.

 

filename jjj filesrvc folderpath='/Public';

data mydata;

   infile jjj('xxxxx');

   input;

run;

6 REPLIES 6
BrunoMueller
SAS Super FREQ

A sas7bdat file is a SAS data set. In oder to access it one needs a SAS libref pointing to the directory where this file is stored. A LIBNAME statement can not point to a folder in SAS Content. So you need to make a binary copy of the file. see the code below for an example. Please be aware that the value used for LRECL= must be big enough to accommodate the size of the file.

 

/*
 * make a binary copy of the file from SAS Content
 * to the directory the work library is pointing to
 */

%let lrecl= %eval(1024 * 1024 * 1024 -1 );
options msglevel=i;

filename src filesrvc folderpath='/Public' name="cars.sas7bdat" recfm=n lrecl=&lrecl;

filename dest "%sysfunc(pathname(work))/newcars.sas7bdat" recfm=n lrecl=&lrecl;

data _null_;
  rc = fcopy("src", "dest");
run;
data newcars2;
  set work.newcars;
run;
Tom
Super User Tom
Super User

??  Why should you have to set a large LRECL?  Why would it matter with RECFM=N?

 

I have had no trouble just use RECFM=F LRECL=512 as a default way to get SAS to copy binary files.

Does that not work in this case?

jins
Fluorite | Level 6

i tried this and this seems to work. thanks!

BrunoMueller
SAS Super FREQ

Thanks for the tip, I can confirm it works with your options very well. Advantage you do not have to care about the size of the file.

jins
Fluorite | Level 6

I had a follow-up question.

If I have to create an external CSS stylesheet (.css or .txt) in HTML form, where should I save this .txt file and how should I refer this?

<head>

<link rel="stylesheet" type="text/css" href="/.............txt" />

 

I tried saving in the work location but it does not seem to work. Any thoughts on how you would approach this in SAS Viya 3.5?

jins
Fluorite | Level 6

thanks for the explaining this.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1911 views
  • 2 likes
  • 3 in conversation