DATA Step, Macro, Functions and more

Is it possible to change the sas catalog name (from auto generated name to a different name e.g., 'sasmacr.sas7bcat to 'myname.sas7bcat')

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Is it possible to change the sas catalog name (from auto generated name to a different name e.g., 'sasmacr.sas7bcat to 'myname.sas7bcat')

We cant do this manually by renaming, i suppose.

I tried like copiying the catlog from one location to another with a different name.

libname test 'location';

proc catalog catalog=test.sasmacr1 force;

copy in=test.sasmacr1 out=work.sasmacr;

quit;

By this way, i was able to rename from 'sasmacr1' to 'sasmacr'.

Is there a possible to do this even more simply? Is there a way to rename a macro catalog?


Accepted Solutions
Solution
‎10-09-2014 09:12 AM
Super User
Posts: 9,662

Re: Is it possible to change the sas catalog name (from auto generated name to a different name e.g., 'sasmacr.sas7bcat to 'myname.sas7bcat')

Yes. I think so. Check proc datasets + change

View solution in original post


All Replies
Solution
‎10-09-2014 09:12 AM
Super User
Posts: 9,662

Re: Is it possible to change the sas catalog name (from auto generated name to a different name e.g., 'sasmacr.sas7bcat to 'myname.sas7bcat')

Yes. I think so. Check proc datasets + change

Valued Guide
Posts: 3,208

Re: Is it possible to change the sas catalog name (from auto generated name to a different name e.g., 'sasmacr.sas7bcat to 'myname.sas7bcat')

Proc catalog is for managing catalogs (sas7bcat) and proc datasets for datasets(sas7bdat). Their internal structure is different.

If you know what your are doing you could rename the datasets at the OS level.

---->-- ja karman --<-----
Super User
Posts: 9,662

Re: Is it possible to change the sas catalog name (from auto generated name to a different name e.g., 'sasmacr.sas7bcat to 'myname.sas7bcat')

Jaap, Haha, actually that is not true. According to SAS documentation. it can change Macro entry name.

CHANGE Statement

Renames one or more SAS files in the same SAS library.

and I also give it a try :

390

391  proc datasets library=x nolist nodetails;

392  change sasmacr=mymac ;

393  quit;

NOTE: Changing the name X.SASMACR to X.MYMAC (memtype=CATALOG).

NOTE: PROCEDURE DATASETS used (Total process time):

      real time           0.00 seconds

      cpu time            0.01 seconds

Xia Keshan

New Contributor
Posts: 4

Re: Is it possible to change the sas catalog name (from auto generated name to a different name e.g., 'sasmacr.sas7bcat to 'myname.sas7bcat')

Thanks for the answers, I have another question on this,

If i have 2 catalogs in a single library, (eg., 'sasmacr' and 'mycat' - by copying mycat from a different location) , i am able to access macros from the catalog 'sasmacr' and not from the catalog 'mycat'.

after setting a macro library with options mstored and sasmstore=<libname>,,,

if i try to use the entries from 'mycat' i am getting error message like 'Macro not resolved'

Should i change any option so that i could use both the catalogs.?

Help me with a solution..

Reply for any clarification required in the question

Super User
Posts: 9,662

Re: Is it possible to change the sas catalog name (from auto generated name to a different name e.g., 'sasmacr.sas7bcat to 'myname.sas7bcat')

You could try option :

options SASAUTOS= ( work 'c:\temp\')      MAUTOSOURCE    ;

Super Contributor
Posts: 305

Re: Is it possible to change the sas catalog name (from auto generated name to a different name e.g., 'sasmacr.sas7bcat to 'myname.sas7bcat')

Hello,

This will do it:

proc datasets library=test memtype=catalog nolist;

change rest=eee;

quit;

Valued Guide
Posts: 3,208

Re: Is it possible to change the sas catalog name (from auto generated name to a different name e.g., 'sasmacr.sas7bcat to 'myname.sas7bcat')

Yep I have seen it, it is at the catalog level (sas7bcat name) possible.

your are right.

At some moment this was all worthless for me. So I must get that dust away for what was going on.

The situation:

- Fixed catalog names, part of the autoexec setup.   No need for rename just for managing the content of those catalogs.

- SCL usage needing to manage the members in a catalog.

  The datasets tables are manageable with proc datasets (Copy move) but failed at the catalog member content.

- As releasemanagement being setup supporting DTAP. The libraries having setup in concatenation.

  In this way you can solve the "which version is active" question. by moving the catalogmembers to the according locations.

  As there is no version present in D there can be also no mistake for getting seeing the wrong version.

  This worked for formats also with an addition to combine a data-defined version when it data-content related

- proc datasets is supporting a move statement (data only) but proc catalog is not.

  I ended up using proc upload/download for catalogs as with a copy that does a really merge with existing content.

It also does change the security context using another key so that the developer cannot develop code an other location than development.

O they like to change all  kind of things when incidents are coming in direct in the production environment without a change order.    

In some cases we did the rename/copy at the OS level verify some assumptions and went back to the original state.        

Looks to me usefull information for others.

---->-- ja karman --<-----
Valued Guide
Posts: 3,208

Re: Is it possible to change the sas catalog name (from auto generated name to a different name e.g., 'sasmacr.sas7bcat to 'myname.sas7bcat')

And see one question in the same direction.

I preferred macros at the source level being compiled when needed. It eliminates the question whether the source and the compiled version are belonging to each other.

Setting it up into a dtap concatenation as previous described.

For macros source type: SAS(R) 9.4 Macro Language: Reference, Second Edition (SASautos) I think there is something strange here as it can refer to libnames and filerefs.  

For compiled macros there is SASMStore SAS(R) 9.4 Macro Language: Reference, Second Edition  It does not have an concatenation type. The libarary def-s do support concatenation. SAS(R) 9.4 Statements: Reference, Third Edition

For FCMP binaries you can imagine a similar approach.  SAS(R) 9.4 System Options: Reference, Third Edition  (cmplib)

---->-- ja karman --<-----
Valued Guide
Posts: 3,208

Re: Is it possible to change the sas catalog name (from auto generated name to a different name e.g., 'sasmacr.sas7bcat to 'myname.sas7bcat')

There is a new method to insert values to existing system options.

SAS(R) 9.3 System Options: Reference, Second Edition (listinsertappend)    SAS(R) 9.3 Companion for UNIX Environments (insert example)

saving automamacros and using: SAS(R) 9.4 Macro Language: Reference, Second Edition

---->-- ja karman --<-----
☑ This topic is SOLVED.

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

Discussion stats
  • 9 replies
  • 427 views
  • 5 likes
  • 4 in conversation