DATA Step, Macro, Functions and more

Read remote files on network drives in SAS Base

Reply
Contributor
Posts: 66

Read remote files on network drives in SAS Base

[ Edited ]

hi,

 

I am running SAS 9.4 TS Level 1M3 on 64 bit Windows 7 PRO. I was wondering how remote files on network drives into SAS installed in my local machine. I am able to view my remote files in my web browser, as the following screenshot shows:

mappedNetworkDriveZ.png

 

However, SAS is able to show only the local drives (C, D and E here). None of the mapped network drives is shown :

SAS_contentsOfComputer.png

 

 

My local drives and network drives can be accessed on my computer:

localDrives_networkDrives.png

 

I have tried to read the remote files in SAS base. But none of the following code works

 

filename outfile 
	sftp '/mnt/lustre/working/lab_xMan/xMan/PRS_UKB_201711/allelicScoresCompiled/output/uniqSNPs_allUKBs_Release8-HRCr1.1/dosageFam_Release8_HRCr1.1/innerJoinedSNPsByCHRBP_metaDataQCed_Release8_HRCr1.1_AND_GWASQCedChrConcat_UKBAllPhenotypes/sasTest.sas7bat'
	host="hpcapp01.adqimr.ad.lan"
	user="xMan"; /*actual username is masked*/
data _null_;
   file outfile;
   do i=1 to 10;
      put i=;
   end;
run;

/*access files in mapped drive Z. Not working*/
filename a "Z:\LabData\testdiagIRT.sas7bat";
%put %sysfunc(pathname(a));
data test; file a; run;

/*access files in mapped drive Z. Not working*/
proc import datafile= "Z:\LabData\testdiagIRT.sas7bat"
	out=test 
	dbms=dlm replace;
	datarow=2;
	GETNAMES=YES;
	guessingrows=2328;
run;

How do I connect SAS to my network drives? Some posts suggest to check SAS/CONNECT. My SAS was installed 2 years ago. I cannot recall if SAS/CONNECT was installed nor could I see such a folder under my C:\Program Files\SASHome

 

Can anyone provide (a link to) a step by step guide for connecting mapped network drives in SAS Base? I saw some posts about this but it is in SAS EG.

 

Thanks

Super User
Posts: 3,777

Re: Read remote files on network drives in SAS Base

Misspelling? Try sas7bdat not sas7bat.

Super User
Posts: 9,611

Re: Read remote files on network drives in SAS Base

You do not import a .sas7bdat file, as it is already a SAS dataset.

What happens if you try

libname labdata 'Z:\labdata';

?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Occasional Contributor
Posts: 15

Re: Read remote files on network drives in SAS Base

Per the second screenshot, you are accessing the files located on a Windows server, right?

 

I also have this kinds of mapping drive at work environment.

 

You can try to libname the full path, not the Z shortcut, which in your case :


libname zdrive "\\hpcsmb\LabData\" ; *\\hpcsmb is the server name, and please make sure this is the full path; 

Ask a Question
Discussion stats
  • 3 replies
  • 142 views
  • 5 likes
  • 4 in conversation