BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi All,

I need to find and replace a text string present in the PDS members. From the SAS Forum, http://support.sas.com/forums/thread.jspa?messageID=9643▫

I have managed to write a macro to read the PDS members. Now how should i edit these members, to do find and replace functionality.

Kindly suggest me.

Thanks In Advance.. Message was edited by: Pri
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You can use a DATA step approach to read/write a PDS member (preferably to a new PDS library, not in-place), either using INFILE/FILE or by using a FILENAME allocation. First you will need to read the PDS directory to get the list of members to process - this can be done with PROC SOURCE.

Have a look at the SAS Companion Guide for z/OS.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search arguments, this topic/post:

filename pds site:sas.com
+"proc source" site:sas.com
Peter_C
Rhodochrosite | Level 12
agree with Scott .... you should write a program to create a copy of the whole PDS with any changes you need within any relevant members. Programs add up to a whole lot less diskspace than the data and problems that can be caused by program-update-in-place.
However, PROC SOURCE was built in the days when SAS only ran on IBM mainframes and it was useful to have a "deck" to recreate the "SOURCE" pds with the IBM utility iebupdte. The "Example 4: Update a Library Member" can be found at http://publib.boulder.ibm.com/infocenter/zos/v1r9/topic/com.ibm.zos.r9.idau100/u1441.htm#u1441
This is not the direction I would recommend as the way to provide your best solution.
Since you might like to replace a variable name or a formula, with something wider, program lines could become wider than the original.
I would recommend writing a new pds(E) with variable length records supporting up to the normal 255 width default on other platforms.
Once you have reviewed the resulting pds(e), [ use the "superce" compare utility to reduce the compare time ] swap original/new names.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Note that there are limitations to PROC SOURCE, if for other than processing the directory -- recommend read the directory and then input/parse/change/output your PDS members each in an individual DATA step.

Also, there is another similar post/thread here in the EG forum:

http://support.sas.com/forums/thread.jspa?threadID=2518


Scott Barry
SBBWorks, Inc.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 1425 views
  • 0 likes
  • 3 in conversation