| Date: | Mon, 20 Apr 2009 10:44:27 -0700 |
| Reply-To: | Dornak <postitdummy@ARCOR.DE> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Dornak <postitdummy@ARCOR.DE> |
| Organization: | http://groups.google.com |
| Subject: | Re: Help with code |
|
| Content-Type: | text/plain; charset=ISO-8859-1 |
I forgot the semicolon and the quit;
proc sql;
create table newdataset as
select a.*
from currentmonth a,
standard b
where a.market=b.market
and a.product=b.product
;
quit;
This is equivalent to
proc sql;
create table newdataset as
select a.*
from currentmonth a
inner join standard b
on a.market=b.market
and a.product=b.product
;
quit;
If you want all lines of currentmonth in newdataset no matter if the
same line was found in standard use a left join:
proc sql;
create table newdataset as
select a.*
from currentmonth a
left join standard b
on a.market=b.market
and a.product=b.product
;
quit;
This may be useful if the market is spelled differently in standard
than in the dataset of your company as you wrote.
I do not know much about string matching. Just one thing
substr("Hello",2,2) returns "el". You might want to try to match only
the first few characters of the market:
and substr(a.product,1,5)=substr(b.product,1,5).
There are may string manipulation functions. If you specify your
difficulty in matching lines, someone might be able to give more
useful advice.
Hope that helps a little.
Dornak
|