Thanks for the reply, I've managed to fix this by using:
options validvarname=any ;
proc datasets library=work;
modify &&fname&i;
rename _ = '!'n ;
run;
I've got quite a few csv files with different headers so didn't fancy lots of proc imports.
Thanks
SP
...an input file which I've been asked to strip out some policy numbers. The problem arises with the first variable being called '!' i.e.
!,polref
*,1
*,2
*,3
*,4
*,5
PROC IMPORT OUT= WORK.exclam
DATAFILE= "C:\Scott\PeskyExclamation.csv"
DBMS=CSV REPLACE...
Thanks for the interest CW, do you mean 'getnames' and 'datarow', I tried them, didn't give us the result we were looking for as in my post '11 Sep 07 11:53' at the top. Are there any other options available within proc import?
SP
Great Klaz this works fine, should be a solution to our needs, had to put a couple of 'LRECL=3000' comments at the end of my filenames to make sure I'm getting all the columns but it works a treat.
Thanks very much.
SP
Thanks for the quick reply, I'm afraid I can't use INFILE as there's too many VARS and multiple CSV files with different column headers to set up a generic programme to cover them all. Basically the CSV files I've been given aren't any good they've specifically been setup for another (tedious)...
...import.
Here's an example:-
blah blah blah blah blah
blah_blah, blah
blah, blah
blah,T1,I,I,I,I
!,SPCODE,POLREF,INRREF,COVREF,AGE_AT_ENTRY
*,1,91000074,1,1,26
*,2,91000077,1,1,26
I've substituted some descriptions with blah as it might be confidential. If I use:-
proc import...
...it reads the other ones in but doesn't seem to hold them out in my 'set' statement which I'm just trying to fix:-
filename blah pipe 'dir C:\Scott\*.rpt /b';
data _null_;
infile blah truncover end=last;
/* Edit length as needed */
length fname $20;
input fname;
i+1;
/* The...
Thanks for the swift response and that's useful stuff, but what I have are a list of .csv type files (for our purposes they are called.rpt) which I need to read in and for every .rpt file I need to assign a variable called 'projclas'. Projclas has to match the .rpt filename it's reading in as in...
...datastep if I can? Needless to say I'll have multiple file to import and assign individual names for var 'projclass' in this example.
Thanks
SP
:-
proc import datafile ="C:\MPFS\u226aw.rpt" OUT=sp1 dbms=csv replace;
getnames=yes;
datarow=2;
run;
*;
Data a1;
set sp1;
projclas='U226AW';
run;
Yep, I've had to do this, we've got about 16 different formats all concatenated together so I've set up 16 different import procedures in a macro which works o/k, bit of a pain tho.
Anyway thanks for the reply.
SP
...but I can’t as the variables are mixed up in the
concatenated dataset. I’d rather not individually set up
an import procedure for every change of u****** as
there’s loads plus the record length is 4000 so there are
lots of vars as well.
Any suggestions great fully received.
Using JCL &...
I'm trying to do something which should be simple but am having problems with, basically using the underneath table I need to sum my 'unitts' field so it will give me a sum by polref inrref covref funds so obs 5 will show '249.57'.
PROC MEANS, PROC PRINT, with by statements work but I need the...
I've got quite a few variables, the array holds units and fund values for 50 versions, not to mention key variables. I've quickly tested your second suggestion and it seems to work fine, thanks very much.
SP
Hello, I have some data in held in an array which I've managed to extract and it looks like this:-
Obs inrref covref f1 f2 f3 unitt1 unitt2 unitt3
1 1 1 628 . . 725 0 0
2 2 1 . 629 . 0 565 0
3 3 1 . . 312 0 0 18...
Hello, I've been using retain to create a rolling summary of unit1 (see units1), what I need to do now is stop this rolling summary so I can use 'IF.LAST.covref' to give me lines I'm after i.e. obs8 obs16 obs23 obs30 (there are other variables but I can't fit them in here) to give me the sum of...
Anyone know how to eliminate the top two blank rows that ODS CSV creates?
Thanks
Scott(SAS8.2 TSO JCL MVS)
My code below:-
ods CSV body=CSV
style=minimal
rs=none;
*;
proc print;
run;
ods CSV close;
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.