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;
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.
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;
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
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;
:
Iam bit confuse in it
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.
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.