Hello.
I wish to translate a SAS data file to text, and do not have the professional
version of SAS to do so.
I have the student version of SAS, and have translated the shortest of 4 SAS
data sets given.
For the other 3, I wish to construct a python program to read the characters in, one
at a time, translate them to hexadecimal, then figure out how the data matches
the data dictionary that I have.
I experimented with writing code in C++ to do this.
My first experiment, in C++ is
#include <stdio.h> #include <iostream> #define TRUE 1 /* Define some handy constants */ #define FALSE 0 /* Define some handy constants */ ifstream f("CMT_MCAID",ios_base::binary); ofstream G("mcaid.txt",ios_base::app); char ch int k int kh,kl int limit limit = 1000
for (int I=1;I<= limit;I++)
{ f >> ch; k = ch; kl = k%16; kh = (k -kl)/16; G << kh," ",kl," "; }
How can I begin to experiment using python? What would be python code equivalent
to the above C++ code?
|