BookmarkSubscribeRSS Feed
shubham1
Calcite | Level 5
%macro chk_dir(dir=);

data _null_; /*_dir=strip("&dir");*/ sti=scan("&dir",-1,'\'); folder=reverse(subpad(reverse("&dir"),index(reverse("&dir"),'\')+1)); newdir1=dcreate(sti,folder); if newdir1 ne '' then put "NOTE: Directory &dir is created"; run; %mend chk_dir; %MACRO DOWNLOAD_SAS_BIB(DSN); %let path=c:\new; %chk_dir(dir=&path.\&DSN); LIBNAME OUTME "&path.\&DSN"; OPTIONS VALIDVARNAME=any; %SYSLPUT DSN=&DSN; RSUBMIT;
OPTIONS VALIDVARNAME=any; LIBNAME GETME "&DSN." DISP=OLD; OPTIONS OBS=MAX; PROC DOWNLOAD INLIB=GETME OUTLIB=OUTME V6TRANSPORT; RUN; LIBNAME GETME CLEAR; ENDRSUBMIT; %MEND DOWNLOAD_SAS_BIB; %MACRO TEST1(BIB); OPTIONS COMAMID = TCP; signon Rsysv user="&_host_user" password="&_host_pass" noscript; %DOWNLOAD_SAS_BIB(&BIB.); %END; %MEND TEST1; %TEST1(SKJH.UVT.SAS); %TEST1(SB24.NEW.SAS);

 

What I am doing in this program is I am downloading the SAS dataset from mainframe to windows

 

When I am running the program with this dataset SKJH.UVT.SAS it is running fine

 

but when I am running with this dataset SB24.NEW.SAS it shows me the error

 

ERROR: Cannot open data library GETME because it is uninitialized and user has only read access.

 

What I am thinking the error is beacuse this dataset SB24.NEW.SAS when I am opening in mainframe it shows me the error:Invalid block size it is empty and having block size and record length =0

 

 

can somebody help me what changes should I make in my code so that when i have dataset with block size and record length =0 it should not run proc download step and program should not be in error

 

2 REPLIES 2
SASKiwi
PROC Star

You don't need DISP = OLD on the LIBNAME you are only reading from DISP = SHR is all you need. Why are you using the V6TRANSPORT option? Removing that will enable SAS to convert the datasets correctly for you.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 693 views
  • 1 like
  • 3 in conversation