>
>Anyhow, I can verify that I see the exact same results as you. I know that's no consolation.
>
>Maybe you can try using GridExtras (
http://www.sweetpotatosoftware.com/spsblog/PermaLink,guid,d6d71562-1655-4518-9341-527932970583.aspx). This is what I use for all importing and exporting of data from Excel, it may be able to handle CSV too.
Yes, I was able to get similar results with the program code as given (dates aren't interpreted properly) -- but this is not surprising since in my environment is SET DATE AMERICAN
However, if in the given code, I insert the following lines at the top:
SET DATE BRITISH
SET CENTURY ON
it starts working correctly.
Original code:
CREATE CURSOR MyCursor (perfil C(1), act_med C(7), anno N(4), autog C(15), caso C(2), cas_ref C(3), codcen C(4), cod_egre C(1), complica N(2);
, diag C(7), diag2 C(7), diag3 C(7), diagegre2 C(7), diagegre3 C(7), dias N(3), dias_esta N(5), edad N(3), fecha D, fec_egre D;
, fec_nac D, gdx C(3), gere C(3), historia C(7), horae C(8), horai C(8), id C(6), mes N(2), meses N(3), nive C(2), nombre C(40);
, pac_e C(1), pac_s C(1), prioridad C(1), refere C(1), referido C(3), semana N(2), servi C(3), servirgh C(3), sexo C(1), tipat C(1);
, tipo_ase C(2), topico C(20), ubigeo C(6), svei N(1), idmes C(2), sele N(1), epidem N(1))
APPEND FROM "MyCSV.csv" TYPE CSV
GO TOP
BROWSE NOMODIFY
Modified code:
SET DATE BRITISH
SET CENTURY ON
CREATE CURSOR MyCursor (perfil C(1), act_med C(7), anno N(4), autog C(15), caso C(2), cas_ref C(3), codcen C(4), cod_egre C(1), complica N(2);
, diag C(7), diag2 C(7), diag3 C(7), diagegre2 C(7), diagegre3 C(7), dias N(3), dias_esta N(5), edad N(3), fecha D, fec_egre D;
, fec_nac D, gdx C(3), gere C(3), historia C(7), horae C(8), horai C(8), id C(6), mes N(2), meses N(3), nive C(2), nombre C(40);
, pac_e C(1), pac_s C(1), prioridad C(1), refere C(1), referido C(3), semana N(2), servi C(3), servirgh C(3), sexo C(1), tipat C(1);
, tipo_ase C(2), topico C(20), ubigeo C(6), svei N(1), idmes C(2), sele N(1), epidem N(1))
APPEND FROM "MyCSV.csv" TYPE CSV
GO TOP
BROWSE NOMODIFY
IMPORTANT: Even if you were careful to put SET DATE BRITISH in the main program file, if the code in question executes in a private data session -- the default configuration of SET DATE AMERICAN will be in effect (unless of course you set it explicitly in code). (i.e. in private data session, the system defaults apply)
Another point: Another point to be careful about is if you have date or datetime constants in your code, make sure you specify them in the explicit format of {^yyyy.mm.dd} (or use the DATE() function) rather than a region-dependent format. Where this could bite you is the interpretation of that the interpretation of such constant in code is dependent on the region configuration
at the time the code is compiled. Expressions such as CTOD("01/02/03") would give different results at runtime, depending on the date format set at the time that line of code is executed.
dDate = {01/02/03}
dDate = CTOD("01/02/03")
dDate = {^2000.01.02}
dDate = DATE(2011,01,03)