Help using Base SAS procedures

How to tell a format's location

Reply
Regular Contributor
Posts: 204

How to tell a format's location

Hello everyone,

if I want know the location of  a variable 's format what can I do? please look the example code below.

Image two people A and B.

people A create a dataset one use the code below. and people B don't know how data set one was created by A, but B want know its variable 'age 's format location(c:\mylib). how to do it? can we use information from sashelp.vformat? or any other method?

Thanks

libname mylib "c:\mylib";

proc format library=mylib;

value fmt_age

0-13 = 'AAA'

other ='BBB';

run;

option fmtsearch=(mylib);

data one;

set sashelp.class;

format age fmt_age.;

run;

----------

Thank you Jagadishkatam and  Hai.kuo: I summarized it:

method 1:

proc sql;

create table need1 as

select a.libname, a.fmtname, b.path from dictionary.formats a, dictionary.libnames b

where UPCASE(FMTNAME)='FMT_AGE' AND A.LIBNAME=B.LIBNAME;quit;

method2

proc sql;

create table need2 as

select a.libname, a.fmtname, b.path from sashelp.vformat a, sashelp.vlibnam b

where UPCASE(FMTNAME)='FMT_AGE' AND A.LIBNAME=B.LIBNAME;quit;

Super User
Posts: 10,490

Re: How to tell a format's location

This code will get information related any versions of the format(s) with the name you supply:

proc sql;

   select *

   from dictionary.formats

   where fmtname="NAMEOFFORMAT"

   ;

QUIT;

The name of the format is stored in uppercase. You can link to dictionary.libnames to get the path of the library if needed.

NOTE: To be in the dictionary table the library must be known to the system at the time the program is run.

Respected Advisor
Posts: 3,124

Re: How to tell a format's location

proc sql;

select a.libname, a.fmtname, b.path from dictionary.formats a, dictionary.libnames b

where UPCASE(FMTNAME)='FMT_AGE' AND A.LIBNAME=B.LIBNAME;quit;

Trusted Advisor
Posts: 1,128

Re: How to tell a format's location

Alternatively by datastep also we could find the location of the formats library.

data want;

   set sashelp.vformat;

   where upcase(fmtname)='FORMATNAME';

run;

Thanks,

Jag

Thanks,
Jag
Regular Contributor
Posts: 204

Re: How to tell a format's location

method 1:

proc sql;

create table need1 as

select a.libname, a.fmtname, b.path from dictionary.formats a, dictionary.libnames b

where UPCASE(FMTNAME)='FMT_AGE' AND A.LIBNAME=B.LIBNAME;quit;

method2

proc sql;

create table need2 as

select a.libname, a.fmtname, b.path from sashelp.vformat a, sashelp.vlibnam b

where UPCASE(FMTNAME)='FMT_AGE' AND A.LIBNAME=B.LIBNAME;quit;

:

N/A
Posts: 1

Re: How to tell a format's location

Iam bit confuse in it

Buy Cheap Youtube views

Ask a Question
Discussion stats
  • 5 replies
  • 270 views
  • 6 likes
  • 5 in conversation