Say, does anyone have a macro handy that converts a column from a data
set into a macro variable containing a list of the same values. For
example, convert x_data into x_var below.
I imagine this isn't too hard, but involves one of the many SAS tricks
that I don't know. Thanks for sharing your magic.
%let x_var = 1 2 3;
> Say, does anyone have a macro handy that converts a column from a data
> set into a macro variable containing a list of the same values. For
> example, convert x_data into x_var below.
> I imagine this isn't too hard, but involves one of the many SAS tricks
> that I don't know. Thanks for sharing your magic.
> data x_data;
> input x;
> %let x_var = 1 2 3;
select x into : var1 separated by " "
> Paul wrote:
> > Say, does anyone have a macro handy that converts a column from a data
> > set into a macro variable containing a list of the same values. For
> > example, convert x_data into x_var below.
> > I imagine this isn't too hard, but involves one of the many SAS tricks
> > that I don't know. Thanks for sharing your magic.
> > Paul
> > data x_data;
> > input x;
> > datalines;
> > 1
> > 2
> > 3
> > ;
> > run;
> > %let x_var = 1 2 3;
Create Macro Variable with Obs Count of Data Set Hello,
I would like to create a macro variable which contains the observation
count from a data set. Right now I use something like...
Proc sql noprint;
The problem I am running into is that sometimes the data set does not
exist. This produces an error:
42 Proc sql noprint;
43 Select count(*)
44 Into :dscnt
45 From have
ERROR: File WORK.HAVE.DATA does not exist.
NOTE: The SAS System stopped processing this step because of errors.
Re: how to covert macro variables into sas data sets? #3 <table cellspacing='0' cellpadding='0' border='0' ><tr><td style='font: inherit;'>thanks, Scott! <br><br>Vincent<br><br>--- On <b>Thu, 5/15/08, Bucher Scott <i><SBucher@schools.nyc.gov></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">From: Bucher Scott <SBucher@schools.nyc.gov><br>Subject: RE: how to covert macro variables into sas data sets?<br>To: firstname.lastname@example.org...
Re: Creating Macro variable and value its value from a data set. #2 Alex,
input MacVar $ Val;
/* 1. Get the variable names and values into macro variables */
%let nvars =3D 0; /* just in case input dataset is empty */
select macvar,val into :var1 thru :var999, :val1 thru :val999 from t;
%let nvar =3D &sqlobs;
/* 2. assign the values to the specified macro names */ =20
%do i =3D 1 %to &nvar;
%let &&var&i =3D &&val&i;
Re: Macro variable for Data set name is being "parsed", #6 691799 Summary: Short lesson in when to macro quote
Mark and Toby resolved the problem, but didn't explain when to macro
Whenever you use macro quoting, you should ask what am I hiding and
from whom am I hiding it.
1 %macro regions(regions=);
2 %put regions=®ions.....;
3 %do i=1 %to 13;
4 %let reg=%qscan(®ions,&i,%str( ));
5 %put Value of region is ®
6 %let dsn=region®.2006;
7 %put Value of dsn is &dsn ;
8 data work.&dsn;
9 set zip_htc_r(where=(region="&r...
Converting Macro Variable to a SAS Dataset Variable If I have a macro variable p1 where %put <<p1>>; results in <<p1>> 01,02,03,06
How do I bring value of p1 to a dataset. Can I make a dataset variable which
has the same values as of p1.
Thanks in advance for your help,
Setting a macro variable inside a macro. Hi,
I want to set a macro variable subj inside a macro based on a condition. But this is not working. Kindly
suggest why. Is the statement inside IF ok?
%if (&prod_class_invalid='Y' or &prod_type_invalid='Y'or
&source_invalid='Y' or &contact_invalid='Y' or &presac_invalid='N' or
&acct12_missing ='Y' or &sac_date_missing='Y') %then %do;
American Express made the following
annotations on 12/19/06...
Re: How to set two data sets but only keep variables in the first #2 > From: Poohbear
> I have two data sets, each one has more than 200 variables
> (some of them are same, some are not). I wanna keep all
> variables of the first data set.
> How do I set two data sets but only keep those variables in
> the first data set? I cannot use keep= or drop= option since
> there are too many variables.
you probably want to examine your question
which we read as:
How can I do action X
and not use the (only) tools available to do action X?
Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov
set some fiile data as a variable I'm trying to get some information from a file
and i can print the right data to shell using
print ($line =~ m/\(-vop crop\=(\d+)/g )
but i want to be able to set this as a variable instead.
I know if i set that line equal to a variable i will just
get a value of 1 for true. How can i capture the information
print would show in a variable instead of true or false.
In article <_7Fgb.89575$PD3.email@example.com>,
Peter <firstname.lastname@example.org> wrote:
> I'm trying to get some information from a file
> and i can print the right data to shell using
Re: convert a macro variable? 11 %let aaa = 510-555-1212 ;
13 %let b=%sysfunc(translate(&aaa,'.','-'));
15 %put &b;
From: jerry chiu [mailto:chiuj2@YAHOO.COM]
Sent: Wednesday, October 15, 2003 4:13 PM
Subject: convert a macro variable?
If I have mac var aaa
%let aaa = 510-555-1212 ;
and I hope to get a new mac var
bbb = 510.555.1212
Is there a macro function to convert,
from - to .