### Numeric <--> String Conversion

```/* convert numeric to character */
char_year=put(year,4.0);

/* convert character to numeric */
char1='1234.56';
num1=input(char,7.);
```

### Keep variables when they have the same prefix

I want to keep variables when they start from SUM_*.  Could you advise?

You can use the colon modifier to do this.  I have include sample code below.

data sums;

set these2;

keep subgroup

sum_:;

run;

### Excel function for statistical significance

=IF(ABS(\$G3)<0.001,"***",IF(ABS(\$G3)<0.01,"**",IF(ABS(\$G3)<0.05,"*",IF(ABS(\$G3)<0.1,"",IF(ABS(\$G3)>=0.1,"")))))

### Creating a sequence variable by subgroup

data indiv4;
set indiv3;
if N_entry > 9;
run;
proc sort;by subgroup;
run;

data indiv5;
retain sequence;
set indiv4;
by subgroup;
if first.subgroup then sequence=0;
sequence=sequence+1;
run;

### first. and last.

http://www.albany.edu/~msz03/epi514/notes/first_last.pdf

data indiv4;
set indiv3;
if N_entry > 9;
run;
proc sort;by subgroup;
run;

data indiv5;
set indiv4;
by subgroup;

first_id=first.subgroup;
last_id=last.subgroup;

run;

### Variance Almanac of Academic Achievement

Variance Almanac

Hedges and Hedberg (2007) paper:

### Quit SAS without really quitting

when a SAS syntax generates errors involving macro's, SAS stops doing anything even if you submit a new command.  You can submit the following to clean-quit without shutting down SAS.

;*%mend;*);*';*";**/;

### PROC datasets (to delete datasets)

proc datasets library = work kill nolist;
quit;