I have the need to create a variable name with a space and add a macro variable to the end. I'm having a bit of trouble with the syntax.
I have really simplified my example as not to get into the other complexities of my program.
Essentially, I want the variable name to resolve to First Name1...
You need to make the column either a character or number in all datasets.
It sounds like in your case you want to go to number to character. In that case, you need an input function.
data x;
set x;
x = 1;
y = input(left(x),$1.);
run;
I always just created a macro in excel. Have SAS launch the excel (excel has digital signature to avoid macro warning). Then have SAS call said macro and have Excel do the formatting with VBA. Have the VBA save and close, and then have SAS go back to whatever else you need to do.
Oh, and if some don't have the '|', you could do the index function to make sure and then use an If, then statement.
So, basically:
if index(name,'|') > 0 then rcount = (statement above); else 0;
You just count the number of "|" and subtract 1?
data x;
set master;
rcount =(length(Name)-length(compress(Name,"|"))) - 1;
run;
compress removes the '|' from whatever the variable is leaving you with the number of '|'. Since there is an extra '|' just subtract one. There would be other ways...
Yes, it's in possible. It depends on how many observations you have, but if it's only 1 or you know which (you could use firstobs = n obs = n to get the one you want. Use symput:
data _null_;
CALL SYMPUT ('var1',var1);
run;
and then use the macro variable (&var1) in your e-mail statement...
Try single quotes. I.e.
a_new_string = 'John said, "How are you?"';
I'm not at work though so couldn't test that, but I think that's how you would do it.
If your data is in a SAS dataset (you could also do something similar on a database or if you have a counter for orders you could also sum that variable):
PROC SQL;
CREATE TABLE EXTRACT.ONE_ORDER AS
(SELECT
A.CUSTOMER
,A.MEMBER_NUM
,COUNT(A.MEMBER_NUM) AS MEMBER_COUNT
FROM...
I would imagine that it is n_obs is probably 0 hence it callling the statement. What does your put statement say?
put n_obs=; should output it to the log. Also, your email is blank probably because you aren't placing anything in the variable test. Best would to use a macro variable. Called as...
Thanks for the reply... I did figure out what I needed to do before you replied.
Did find a fairly good resource though... too bad these forums aren't as busy as they used to be...
http://ibmmainframes.com/
I'm a PC SAS programmer, but I've been asked to learn Mainframe using JCL / TSO. I was wondering if there were any resources or guides someone could point me to so I could get started. I'm kind of wading my way through here blindly and have some program examples, but I think it would be helpful...
So, do I have this right - you have the original dataset and you have another dataset you want to add more records to?
If so, why not just do a proc append, and output the file again?
proc append base=work.original data=work.new;
run;
...provided enough info...
libname a "S:\LAB STATS 09_10.mdb";
options validvarname=any;
PROC SQL;
CREATE TABLE A.DS AS
(select
A.*
FROM A.'E_Q Data CNTs'n as A
);
QUIT;
options validvarname=v7;
I don't have SAS in front of me though so I haven't tested...
Try the validvarname any option. This allows spaces in table names. Also, try connecting to your access db as a libname.
Sorry just paraphrasing on the code, but hopefully this will move you in the right direction.
libname a "C:/access.mdb";
options validvarname=any;
proc sql...
from...
Sorry - the alias on the join for seller should say as C not B again.
This part needs corrected:
LEFT OUTER JOIN EXTRACT.Order as C
ON
A.Seller_Order_No = C.Order_No
Here is one way:
This will basically keep all values from transaction and pull in the prices from the order file without dropping anything. I'm not sure if I have interpreted exactly what you need, but hopefully this example will get you what you need or at least get you started. This can...
...a generic example of an equal join:
Note: "Extract" is my defined library.
PROC SQL;
CREATE TABLE EXTRACT.FINAL AS
(SELECT
A.*
,B.*
FROM EXTRACT.FILE1 as A
,EXTRACT.FILE2 as B
Where
A.COLUMN1 = B.COLUMN2
AND A.COLUMN2 = B.COLUMN2
);
QUIT...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.