what you want to do is something like this (if I remember right)
Proc Print data=xxxx LABEL;
var var1 var2...;
Label var1='';
so for each variable in the list you tell it what you want the label to be.
Some of the other Proc Print line options I use include
NOOBS (turns the observation number off)
DOUBLE (double spaces the report - no, there is not a triple)
UNIFORM (makes all of the pages looks the same - note SAS formats the column to the widest one on each page)
SPLIT='*' (you can specify where you want the word split in your labels - ex use Split='*' in the PROC PRINT line and within the rest of the procedure say Label var1='Total*Revenue'; will put the words on seperate lines.
I need to read from a file that has 1800 or so characters in each line. However, i would like to pull out approximately 1000 of these characters and have them outputed into one line. I basically want to create a smaller version of the original record set, yet have it on one line. Right now SAS is breaking the 1000 character record set into multiple lines.
maybe I am missing something here. If you are trying to PRINT the file there is no way that I know of to output 1800 char across a page (and unless your eyes are alot better than mine it would be a BEAR to read).
If you are just trying to create an output file of the data then if you are reading in 1800 bytes of data (depending on SAS version) you can read it in X byte chunks and output same chunks.
So
DATA FILEA;
INFILE INPUT;
INPUT
@1 Part1 $CHAR200.
@2 Part2 $CHAR200.
...
@1600 PartX $CHAR200. @;
Then output them almost the same way...
DATA;
SET FILEA;
FILE YYYYY;<===== OUTPUT FILE
PUT @1 Part1 $char200 /*optional - it knows how read in, but this will force all 200 chars */
@201 Part2 $CHAR200.
...
@1601 Partx $char200. ;
If you are just trying to copy data from one place to another there are much easier ways... if SAS is supposed to manipulate the data in between - THEN we are going fine.
Example 6: Truncating Copied Records
The LENGTH= option is useful when you copy the input file to another file with the PUT _INFILE_ statement. Use LENGTH= to truncate the copied records. For example, these statements truncate the last 20 columns from each input data record before the input data record is written to the output file:
data _null_;
infile file-specification-1 length=a;
input;
a=a-20;
file file-specification-2;
put _infile_;
run;
The START= option is also useful when you want to truncate what the PUT _INFILE_ statement copies. For example, if you do not want to copy the first 10 columns of each record, these statements copy from column 11 to the end of each record in the input buffer:
data _null_;
infile file-specification start=s;
input;
s=11;
file file-specification-2;
put _infile_;
run;
That label trick doesn't work. In most versions of SAS you get a ' in the column header. I once found a piece of code that generates a blank label in a proc print. (I found it buried in some old SAS manual.)(proc report allows blank labels) I don't remember the code exactly, but the idea was that you use the hex value of a blank in the label statement. Since SAS can read asci, hex, binay and now unicode values, the label statement would be 'tricked' into thinking that there was a value and not substitute the variable name (as it normally does in a proc print) for the label. When I tried it, it did work. I have lost that reference so if anyone knows where that example is let me know.
Thanks
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.