Re: TABLES TABLES TABLES
>How would you best describe to a retiscent SAS student that the concept of
>TABLES isn't limited to SQL? This came up during a discussion on table
>lookup methods - and lookup tables in particular (I mean, lookup tables
>date SQL). Even SAS data sets are referred to as tables. This made the
I find a visual works well here. If you show a grid with rows and columns,
you can show a picture of a SAS data set and a SQL table and a lookup table,
and show that (regardless of terminology and buzzwords) they're all pr...Re: load SAS table into DB2 temporary table
Enclose SQL create and delete queries in a SQL EXECUTE() function and pass
them through to DB2. Once you have the table created, you can insert rows of
data (using BULKLOAD to speed up inserting large numbers of rows). Ask your
DB2 DBA about the correct syntax for DB2 temporary table name.
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of tonts
Sent: Wednesday, June 30, 2004 2:31 PM
Subject: Re: load SAS table into DB2 temporary table
Thanks for your answer.
But the problem is a little bit different ...Re: RE : Re: copulas and SAS
Think Joke! But, more seriously, it did prompt me to look up the
origins of the copula as a functional.
On 9/27/06, adel F. <firstname.lastname@example.org> wrote:
> I do not know how this is related to my orginal question.
> My understanding of copula is, it is a joint distribution with uniform
> margins, the problem how to obtain a copula which fits better a data?
> If there is any suggestion from members of SAS list, about examples for
> copulae with SAS, I will appreciate that
> Thanks a lot
> Joe Whitehurst <joew...Re: TABLES TABLES TABLES #2
OHHH went there, did that, got the t-shirt, even. I tried everything in the book. This person is extremely LITERAL and looking for the letter of the law, or something........maybe my trying so hard just egged him on, or his stubbornness that kept his feet in concrete, but I don't think so. He truly believes that.
From: David L Cassell <davidlcassell@MSN.COM>
Sent: Sun, 27 Nov 2005 11:55:12 -0800
Subject: Re: TABLES TABLES TABLES
>How would you best describe to a retiscent SAS student that the concept...Re: SAS Tables
You can use proc transpose to get the dataset you want;
input Age Exp Rate;
1 1 0.9
1 2 1.2
2 1 0.6
2 2 0.2
proc transpose data=have out=want;
2008/11/24 J M <email@example.com>:
> I would like to take this data:
> Age Exp Rate
> 1 1 0.9
> 1 2 1.2
> 2 1 0.6
> 2 2 0.2
> and create this table
> 1 2
> 1 0.9 1.2
> 2 0.6 0.2
> I'm then going to export this output to Excel (which I assume should
> be straightforward using ODS).
> Any suggestions?
...Re: TABLES TABLES TABLES #6
Ahhhh - I'm lovin' that one.
In a message dated 12/1/2005 6:14:05 AM Eastern Standard Time,
Friar Broccoli wrote:
> Try this (a higher authority):
> Howard Wood wrote:
>> OHHH went there, did that, got the t-shirt, even. I tried
>> everything in the book. This person is extremely LITERAL and
>> looking for the letter of the law, or something........maybe...Re: SAS V9.1 SQL table name re-use issue
Thanks to Peter and Bas and I will start using undopolicy=none should I
like to replace a table.
On Wed, 7 Sep 2005 12:08:10 -0400, Peter Crawford
>On Wed, 7 Sep 2005 11:42:25 -0400, T J <tjpush@YAHOO.COM> wrote:
>>Before SAS 9 I have lots of SQL codes that re-uses an existing table name
>>and there was no warning msg.
>>data A; do i = 1 to 5 ; x= ranuni(0); output ; end; run;
>>data b; do i ...Re: DICTIONARY.TABLES #2
libnames are stored in UPPERCASE in dictionary.tables.
On 10/25/07, SAS-FU <firstname.lastname@example.org> wrote:
> Any ideas why this simple code to access dictionary metadata is
> returning 0 observations? I do this all the time, and Im at a new
> contract site and I feel like im taking crazy pills.
> Thanks in advance.
> libname q 'R:\AD-HOC\MAX_Data\DEMO';
> proc sql;
> create table aaa as
> select memname
> from dictionary.tables
> where libname = 'q';
...Re: Problem with dictionary.tables
Try following code see if it works:
proc sql noprint;
select "perm."||memname into :dsn separated by " "
from dictionary.tables where libname = "PERM";
On 6/26/06, email@example.com <firstname.lastname@example.org>
> Dear Newsgroup,
> I'd like to set a few tables together. That's why I read out my needed
> tables with the help of dictionary.tables:
> Here's my code:
> proc sql noprint;
> select memname into...Re: DICTIONARY.TABLES #3
On Thu, 25 Oct 2007 15:07:21 -0000, SAS-FU <lee.rozzelle@GMAIL.COM> wrote:
>Any ideas why this simple code to access dictionary metadata is
>returning 0 observations? I do this all the time, and Im at a new
>contract site and I feel like im taking crazy pills.
>Thanks in advance.
>libname q 'R:\AD-HOC\MAX_Data\DEMO';
>create table aaa as
>where libname = 'q';
yes, I think all libnames are in uppercase in that tables.
To be sure, u could use:
...Re: Lookup Table in SAS
There are a couple ways to do this in SAS. One is to create a "user defined
format" and use a put statement to create a new variable based on the value
of an existing variable and the format that you created. See the SAS
documentation on Proc Format and the Put function. Note that the values
that are used in building this format may be manually typed or may be read
from a SAS data set.
A second way is to merge the two tables and, based on whether there are
matches between the two tables, the flag may be set with program
statements. The following illustrates this approach.
input values $1. ;
informat data2 $10.;
input values $1. data1 data2 ;
b 1 something
x 2 random
k 3 new
by values;* this solution requires that the two data sets be sorted.
The format solution does not require sorting;
merge b (in = in1 ) a (in=in2);
if in1;* select only datalines that exist in b;
if in2 then flag = 1;
else flag = 0;* see sas data set options discussion;
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
...how to add fonts to the sas registry (was RE: Re: sas/graph:
Success! A google search led me to:
Which includes the magic option on FONTREG to use the "all" mode. (And
now that I look back on the FONTREG docs, I see it there was well :-P).
So here's code that works:
* =================================== ;
proc fontreg mode = all msglevel = verbose ;
truetype 'c:\windows\fonts' ;
data phoney ;
do n = 1 to 2000 ;
x = ranuni(-1) ;
if n le 1000 then grp = "one" ;
else grp = "two" ;
device = EMF
ftext = 'Tahoma'
ods rtf file = "c:\temp\deleteme.rtf" ;
proc boxplot data = phoney ;
plot x * grp ;
ods rtf close ;
* =================================== ;
Looks like I've got to add that FONTREG call anew every time (running in
batch anyway). But that's tolerable...
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Thursday, February 28, 2008 8:12 AM
Subject: Re: sas/graph: using truetype fonts w/ODS RTF output on windows
Thanks for the response Mary!
Huh, strange. So you run that code unaltered & get Tahoma in the
graphic in the .rtf file?
I just now tried adding this before the 'data phoney ;' line:
proc fontreg mode = replace ;
truetype 'c:\windows\fonts' ;
And I get ...Re: SAS Table help
Summary: Possible answers - data manipulation.
This might be what you want.
data want ( where = (pctmiss > 10) ) ;
set have ; /* see data below */
nmiss = nmiss (of item: ) ;
/* or nmiss (of itema -- itemf ) ; */
/* or nmiss ( itema, itemb, itemc, itemd, iteme, itemf ) ; */
pctmiss = 100 * nmiss / 6 ;
I have assumed your second requirement
> Another requirement to create the above table where the missing
> values greater than 10% of the total records.
means greter than 10% of the items on a record. If you really mean of
total records, then I do not understand the problem. Perhaps you
should show how to calculate by hand what is wanted.
In genereral you will find the data structure
product item stat
a a 1
a b .
a c 2
b a 2
far more flexible. One way to get this would be
proc transpose data = have
out = good (rename=(col1=stat)) ;
by product ;
var item: ;
Here you might mean
proc summary data = good ;
class _name_ ;
var stat ;
output out = summary nmiss=nmiss ;
data want ;
set summary ;
where nmiss > .1 * _freq_ ;
pct = 100 * nmiss / _freq_ ;
Date: Mon, 2 Feb 2009 13:14:41 -0800
From: Mahbub Khandoker <mk_sas1@YAHOO.CA>
Subject: SAS Table help
Hi there...Re: How to create a TABLE in SAS?
So, I'm presuming that A and B have the same number of observations, and
that observation k in A corresponds to observation k in B.
Then you can do:
merge A B; * will merge row by row;
%let ct = p; %* p output pearson correlations, h for hoeffding, k for
kendall, s for spearman;
proc corr data=C out&ct.=&ct. (where = (_type_="CORR")) noprint;
The output data set will have the b variables as columns, the a variables
as rows, identified by the _NAME_ variable (there will also be a variable
called _type_, with all val...Re: hierarchical table with SAS
SAS is a programming language rather than a database. Hence you have to
program the sort of thing you are asking for yourself. The structure of the
data will strongly influence how easy or hard your programs are.
As you have given the request, you are destroying information. For example,
you no longer can tell who the father of 760 is. I would be inclined to
restructure the data with
data family ;
set hierarchy ;
retain family ;
if father = " " then family = son ;
Now to obtain the family headed by 700 use
proc print data = family ;
where family = &...Re: Summary: Re: Table combining tables? PROC FREQ or maybe
The log might help us see whats going on.....But for now, you can check by
running a summary of your raw data....
proc summary data = today ;
class prop_part ;
var v3_1 -- v3_15 ;
output out = tot sum = ;
proc print data=tot ;
From the 'tot' dataset, look in _type_ = 0, which is the sum of all
variables. If this sum matches the proc freq output which you showed
below, then it may be a data issue. If not, then looking at the log might
On Sat, 28 Jun 2008 22:15:39 -0400, Peter Flom
>Just to clarify what's going on before I go to bed:
>I had a data set. I printed the first 10 observations on key variables,
and sent it to the list, and Howard (among others) gave a solution.
>Then I ran that solution on my original data, and got the wrong results.
>What I sent to the list came from:
>proc print data = today (obs = 10);
> var v3_1:--v3_15 prop_part;
>and looked like this
>Obs V3_1 V3_2 V3_3 V3_4 V3_5 V3_6 V3_7 V3_8 V3_9 V3_10 V3_11 V3_12 V3_13
V3_14 V3_15 part
>1 1 0 0 0 0 0 0 0 0 0 0 1 0
0 0 1: Som
>2 1 0 0 0 0 0 0 0 0 0 0 1 0
0 0 2: All
>3 1 0 0 0 0 0 1 0 0 0 0 1 0
0 0 2: All
>4 0 0 0 0 0 1 ...Re: SAS Sample 1728 Was ---> Re: SAS Sample 1727
Nice thread guys .... I guess this is what open source development is all
Got me thinking about suggesting a code/macro library on sascommunity.org?
...Re: SAS Job websites WAS(Re: SAS jobs for freshers in US
On Fri, 24 Mar 2006 11:27:44 -0500, Steven Raimi <steven.raimi@ONSTAR.COM>
>Another very helpful (and focused) web site for SAS jobs is
>icrunchdata.com. I'll try to
....post from home later, where I have a set of links (I don't have them at
my new job here, which, FYI, I found via Monster).
I'll also try to avoid fumble-fingering that accidently posts my messages
before I'm done writing them!
...Re: RE : Re: copulas and SAS #3 674067
>You may find the following artilce interesting.
[article by Thomas Mikosch not copied]
This is a really good article, and a really useful point to make.
But 55K is a lot of article to copy. Would it have been easier
to point to a URL? The people who read SAS-L as a digest
and the people who have slow connections are probably not
I'll refrain from pointing out that you sound like me today.
("Are you sure you want to do this? Here's some material
which suggests you should try a different approach..."...Re: Recover Deleted SAS Table
most important: DO NOTHING, ALSO NOT OUTSIDE SAS which could replace the
Now use a undelete tool, which you downloaded from web with another PC (do
it not on the PC the file is on)! The place is not reserved and might be
used by any software to store something. In that case you have no good
One of many examples: http://www.undelete-plus.com/download.html
But there are many...
Don't install that on your PC! That might replace parts of your deleted
file! Install it on a USB stick and start it from that. Look in web for a
tool which is able to do that!
If that is successful, you should look for your file with the
extention .sas7bdat and restore that. Have a look into the library with
SAS and try to open it then.
Hope, that this will work.
On Tue, 16 Dec 2008 07:58:10 -0600, OR Stats <stats112@GMAIL.COM> wrote:
>I created a library within SAS that points to a folder in MyDocuments. I
>have XP OS. I accidentally deleted one of my SAS tables in this folder.
>And I need that table. I went to my Recycling bin but did not find the
>table in there. I have not closed my SAS program and have not rebooted.
>there any way I can recover this table?
...Re: Lookup Table in SAS #3
hi ... in the true spirit of "beating a question to death" ... here are a couple more to add to
those already posted (though Howard Schreier's SQL solution is so elegant that I wonder why one
would do anything different) ... given data sets a and b
input values : $1. @@;
a b c d e
input values : $1. data1 data2 : $ 10.;
b 1 something
x 2 random
k 3 new
* add an index to data set a;
proc datasets lib=work nolist;
index create values;
set a key=values/unique;
flag = not (_error_);
* add the next statement if you don't like RC messages in the LOG;
* create a lookup string from data set a;
length ina $50;
set a end=lasta;
ina = catt(ina,values);
set b end=lastb;
flag = (find(ina,values) gt 0);
* a tweak of Nat Wooding's MERGE solution (get rid of IF) ... assumes sorted data sets;
merge a (in=ina) b (in=inb);
flag = ina;
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
> Suppose I have dataset called "Lookup_SAS" that has the following values
> with 1 variable called values
> I ha...Re: SAS Sample 1728 Was ---> Re: SAS Sample 1727 #2
I am not sure that the SI Tech Support examples should have all the error
checking that Chang wanted to throw in the macro. The examples should be
clear concise and easy to read and get going, as well as be illistrative.
Too much error checking in an example well is just over kill and even
detrimental to an example. However, any code solution on the SI Tech
Support web sit should follow basic rules of good practices and sound
advice. Such as with thier macros having atleast a somewhat good Macro
Look at Example SAS Sample 1728:
The first method well lets say is soooo bad...Re: Summary: Re: Table combining tables? PROC FREQ or maybe #2
I've now got several solutions.... SAS-L is great! But the odd behavior of Howard's program on two datasets that ought to have been the same is still puzzling.
Hari Nath <hari_s_nath@YAHOO.COM> wrote
>The log might help us see whats going on.....But for now, you can check by
>running a summary of your raw data....
>proc summary data = today ;
> class prop_part ;
> var v3_1 -- v3_15 ;
> output out = tot sum = ;
>proc print data=tot ;
>From the 'tot' dataset, look in _type_ = 0, which is the sum of all
>variables. If this sum matches the proc freq output which you showed
>below, then it may be a data issue. If not, then looking at the log might
The _type_ = 0 did not match the weird FREQ output that I had gotten. So, here's the log from running Howard's program on my data. I don't know if it will help.
220 data numbered; number + 1; set today3; run;
NOTE: There were 609 observations read from the data set WORK.TODAY3.
NOTE: The data set WORK.NUMBERED has 609 observations and 25 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
222 proc transpose data=numbered out=long;
223 by number prop_part;
224 var v3_ : ;
NOTE: Numeric variables in the input data set will be converted to character in the out...Re: Recover of the variables of a SAS table
Are you just looking for something like:
proc sql noprint;
separated by ' '
where libname eq "SASHELP"
and memname eq "CLASS";
On Sun, 23 Dec 2007 09:15:54 -0800, ash007 <RamsamyAshley@GMAIL.COM> wrote:
>On Dec 23, 3:37 pm, "LWn" <lars.without_this_part.wahlg...@stat.lu.se>
>> Could this help?
>> proc contents data=datasetname ;
>> run ;
>> "ash007" <RamsamyAsh...@gmail.com> skrev i meddelandetnews:dc866f3b-
>> > Hello everybody,
>> > Is someone know how to recover the name of the variables of a SAS
>> > table ?
>> > thank.
>> > ash007.
>thank but I need to put all the variables of a table in a macro
On Dec 23, 8:44 pm, art...@NETSCAPE.NET (Arthur Tabachneck) wrote:
> Are you just looking for something like:
> proc sql noprint;
> select name
> into :namelist
> separated by ' '
> from Dictionary.Columns
> where libname eq "SASHELP"
> and memname eq "CLASS";
> %put &namelist.;