Help using Base SAS procedures

Format in SAS Universal Viewer

Reply
Contributor
Posts: 43

Format in SAS Universal Viewer

Hi expert,

It seems that the SAS Universal Viewer is using user format XML file.
How can I convert a format catalog to this kind of XML file?

Any help will be appreciated.

-Kevin
Super Contributor
Super Contributor
Posts: 3,174

Re: Format in SAS Universal Viewer

Investigate using the SAS XML engine.

Scott Barry
SBBWorks, Inc.

Recommended Google advanced search engine, this topic/post:

export catalog xml engine site:sas.com
Contributor
Posts: 43

Re: Format in SAS Universal Viewer

Thank you for the input.

I have read the SAS 9.2 XML LIBNAME Engine: User's Guide and find only 3 relative options: FORMATACTIVE, FORMATLIBRARY and FORMATNOREPLACE.

However, I tried many times but failed to store format catalog in library with XML engine.

* one sample code;
filename output 'c:\output.xml';
libname output xml xmltype=CDISCODM formatactive=yes;

proc format lib=output;
value test
1='A';
run;

ERROR message in log:
ERROR: OUTPUT.FORMATS.CATALOG cannot be opened because files of type CATALOG are not supported in the OUTPUT library.

Do you have any sample code to convert format catalog into XML file?


-Kevin
Super Contributor
Super Contributor
Posts: 3,174

Re: Format in SAS Universal Viewer

You are attempting to apply the user DOC example incorrectly. In your code, an attempt is being made to physically store the FORMAT/CATALOG member onto the libref/fileref OUTPUT, which is why you are getting the error.

Possibly your understanding about SAS and using FORMATs in this process is confused? You should not intend to export the FORMAT/FORMATC CATALOG member with this process. Instead, this process will tell SAS to apply any referenced formats when exporting a SAS member, based on your LIBNAME options specified.

A more accurate SAS coding technique would be to create your SAS user format, outputting it to the WORK libref (leave off the LIBRARY= keyword), then define a SAS DATA step also outputting a SAS data library member to WORK having a numeric type variable and also a FORMAT statement to reference your user format just created. Then, code another DATA step to export you SAS member and you will see how SAS automatically applies the format accessible through your FMTSEARCH= declaration.

Scott Barry
SBBWorks, Inc.
Contributor
Posts: 43

Re: Format in SAS Universal Viewer

Hi sbb,
Thank you for your input.

Let's get back to start point.
I want to view SAS dataset using SAS Universal Viewer. However, this tool does not support raw SAS format catalog.
It seems that I have to convert the SAS format catalog to an XML file.

I failed to perform the conversion using XML engine.
I am wondering someone can provide an sample code to convert SAS format catalog to XML file, which will be used in SAS Unversal Viewer.

Any help will be appreciated.

-Kevin
SAS Super FREQ
Posts: 8,743

Re: Format in SAS Universal Viewer

Hi:
Are you, by any chance, trying to create DEFINE.PDF or DEFINE.XML for CDISC? If so, I believe that you're on the wrong track in trying to store the SAS Format catalog in XML. The XMLTYPE of CDISCODM is -not- meant to be used in a manner such as you show.

It was my understanding that the CDISC related tagset templates for use with the XML Libname engine were really meant to be used "behind" the scenes either by PROC CDISC, by the SAS CDISC viewer or by the new CDISC toolkit and possibly by DI Studio.

For more information about CDISC and overall data standards, refer to:
http://www.lexjansen.com/pharmasug/2004/FDACompliance/FC02.pdf

For more information about the new CDISC toolkit, refer to:
https://www.sas.com/industry/pharma/cdisc/ (where it says:
SAS recommends using the SAS Clinical Standards Toolkit to create define.xml instead of PROC CDISC. The toolkit is in active development with several additional releases planned. PROC CDISC is maintenance only – no new features will be added.

cynthia
Contributor
Posts: 43

Re: Format in SAS Universal Viewer

Cynthia,
Thank you for the reminder.
I am just want to get SAS format XML file for SAS Universal Viewer.

Any idea?

-Kevin
SAS Super FREQ
Posts: 8,743

Re: Format in SAS Universal Viewer

Hi:
Actually, I have no idea. The most I use the Universal Viewer for is to look at .SAS program files or look at SAS Log files.

I did try to open a data set that had custom user defined formats and SAS did NOT use the format -- not surprising because the format catalog is probably not available to the SAS Universal Viewer.

When I highlight a column (such as birthdate, that's formatted with the DATE9. format, clicking the Format button only toggles between the unformatted number and the DATE9 display of the number. I do not see a place where I can specify a different SAS format. I do see the choice under Tools--> Options to point to a SAS format catalog or to an XML User Format file, but I have no idea what an XML User Format file is. You might wish to ask Tech Support this question.

cynthia
Contributor
Posts: 43

Re: Format in SAS Universal Viewer

Cynthia,

Thank you for the try.
I will ask Tech Support for more details.

-Kevin
Ask a Question
Discussion stats
  • 8 replies
  • 693 views
  • 0 likes
  • 3 in conversation