BookmarkSubscribeRSS Feed
GeorgeSAS
Lapis Lazuli | Level 10

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;

5 REPLIES 5
ballardw
Super User

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.

Haikuo
Onyx | Level 15

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;

Jagadishkatam
Amethyst | Level 16

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
GeorgeSAS
Lapis Lazuli | Level 10

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;

:

laurencarter89
Calcite | Level 5

Iam bit confuse in it

Buy Cheap Youtube views

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 1429 views
  • 6 likes
  • 5 in conversation