I'm trying to generate a variable file name.
ods pdf file = "D:\FileDirectory\&&mFileNameVariable&I .pdf" notoc;
This generates a variable file name but adds a space before the extension (eg. FileName .pdf; I need FileName.pdf).
I read that you could do something like this:
ods pdf file = "D:\FileDirectory\&&mFileNameVariable&I..pdf" notoc;
To add the dot for the extension; however, when I try that macro doesn't work, I get a WYSIWYG value (eg. &&mFileNameVariable&I.pdf).
I'm assuming its because my string ends with a "&I".
Another solution I thought of, but it seams unnecessary / workaround is to trim(FilePathAndName) and, or concatinate cats(of FilePathAndName FileExtension) the values seperately.
Any insight or feedback is much appreciated, thank you in advance for your time and help.
Cheers!
Since you are doing two passes through the macro resolution process, you need an extra period between the filename and the extension (three total, 2 get munched during macro resolution, one to represent the separator).
e.g.
%let mFileNameVariable1=myfile;
%let l=1;
ods pdf file="C:\Temp\&&mFileNameVariable&l...pdf" notoc; /*note 3 periods!!*/
On Log
NOTE: Writing ODS PDF output to DISK destination "C:\Temp\myfile.pdf", printer "PDF".
Related
I would like to know if it's possible to create a pdf file, send it to a print shop, and that each copy once printed has a unique identification number.
For instance, the document would have a fixed content like "Banana". But next to it, there would be a field that gives a different result everytime the document gets printed. Maybe it would be possible to force the printer to print the time when it prints in milliseconds, or any other unique identification? The result I would like to get would be:
Copy #1 : Banana - 42822435
Copy #2 : Banana - 42922998
Copy #3 : Banana - 43059609
etc.
It is possible to have a result like this with a pdf document? I feel like I could get something like that with some code, but I have to go through a print shop. So, I have to be able to just upload a file, and ask them to print multiple copies of it for me.
I hope my question is clear, thank you in advance for any help.
Such functionality would 100% rely on your printer and what they use. It has nothing to do with PDF unless you change and generate a single PDF with 1000 documents and you inject the number. Or you generate 1000 PDFs each with their own number.
I'm trying to store my results in NSArray and save it as CSV File using Objective-C but i don't seem to find any solution which is relevant. Please find the below sample code:
int a=5,b=10;
int c=b-a;
double d=4.5,e=3.0;
double h=d-e;
NSLog(#"host_port:%f", c);
NSLog(#"host_size:%d", h;
I would like to store my values c and h in array and write that to CSV File. Any advise on this would be helpful.
Thanks in advance.
When you ask a question on SO you need to show effort - code you've tried, details of what you've read - if you don't you'll get down and close votes (you have one of each as I write this). The code you have included has nothing to do with CSV or arrays, and is not even pasted in valid code (the formats are wrong).
That said, let's see if you can give you something to get you going.
A CSV file is just plain text, you don't need to use any packages to write one, just standard I/O routines will do the job. You also do not need to store all the values in an array and then output the array, or build up a string version of the whole CSV file and output that, you can output items as they are generated if you wish and it may be more efficient to do so. In your code fragment you only have two values, maybe you intend this to be the core of a loop, and given those we assume you wish the CSV file:
host_port,host_size
5,1.5
your values have basic types, int and double, they are not Objective-C object types. Given this you can use the standard C I/O operations to produce your file.
First you may need to obtain the destination file name from the user, assuming this is a GUI app look up NSOpenPanel for this. That will give you an NSURL from which you can obtain the file path as an NSString, and you can convert that into a C string using NSString methods.
Now you can enter the C I/O world, to find the documentation on the following functions open the Terminal and use the man command, e.g. man fopen etc.
To create and open for writing the file for writing use fopen() passing it the C string pathname you obtained above.
To write the headers and each row of data use fprintf(). This takes a format string just like NSLog(), but you must remember to explicitly include the line breaks by using \n in the format.
When you've finished close the file with fclose().
Now go read the documentation and write your CSV file!
HTH
LOAD DATA
INFILE '/XXINSTANCEXX/applmgr/CUSTOM/xbol/12.0.0/bin/XX_DATA.csv'
REPLACE INTO TABLE XX_STAGING_TABLE
FIELDS TERMINATED BY ","
TRAILING NULLCOLS
This is part of my CTL used in my concurrent program. I need to update the INFILE with every run. I will be aware of the path but i need to change the file name in this example XX_DATA.csv to something else.
Let us assume that we are going to have a particular pattern for the CSV file which I am going to get. So if the file arrives on 9th of April 2015 it will be named as NEWFILE09042015 and a file arriving next day will have the file name of NEWFILE10042015 , a day after NEWFILE11042015 and so on. So we are effectively aware of the file name that we will get but need to find a way by which I can update the same in my CTL file.
How can I achieve this ?
You need to specify the filename on the command line via the DATA option. You will most likely need a wrapper script that will call sqlldr with the right filename.
See this reply for some other alternatives that may work for your situation: insert timestanp of INFILE into a column from SQLLOADER
You can use one or more exported system variables (at least in Unix) in the filename specified by INFILE.
All you have to do is use double quotes instead of single quotes around the file path specified by INFILE.
E.g.:
LOAD DATA INFILE "/XXINSTANCEXX/applmgr/CUSTOM/xbol/12.0.0/bin/$FILENAME.csv"
I am looking for ways to read in a PDF file with SAS. Apparently this is not basic functionality and there is very little to be found on the internet. (Let alone that google is not easy with PDF in you search giving you also links to PDF documents that go about other things.)
The only things that can be found, are people looking for ways to import data into datasets from a PDF. For me, that is not even necesarry. I would like to be able to read the contents of the PDF file in one big character variable. If possible, it would even be better to be able to read in the file's binary data.
Is this possible with SAS and how? (I got it to work in Access VBA, but can't find any similar ways in SAS.)
(In the end, the purpose is to convert this to base64 and put that base64-string into an XML document.)
You probably will not be able to read the entire file into one character variable since the maximum size of a character variable is around 33 KB. A simple way to read in one line at a time, though, is something like the following:
%let pdfFileName = Test.pdf;
%let lineSize = 2000;
data base;
format text_line $&lineSize..;
infile "&pdfFileName" lrecl=&lineSize;
input text_line $;
run;
This requires that you have a general idea of the maximum record length ahead of time, but you could write additional code to determine the maximum record size prior to reading in the file. In this example each line of text is read into one character variable named "text_line." From there, you could use a RETAIN statement or double trailers (##) in the INPUT line to process multiple lines at a time. The SAS web-site has plenty of documentation on how to read and process text from various types of input files.
I am trying to extract a range of pages from a multipage pdf file into individual jpegs using convert (Imagemagick). The extraction works fine. What I am stuck on is that if I want to extract page range 10-20, I still get out jpeg files with names page-0.jpeg to page-9.jpeg while I want them to be named page-10.jpeg to page-20.jpeg. Is there a way of specifying that on the command line?
I require this since I want to extract pages in chucks of 10 to avoid eating up too much memory for huge pdf files and don't want to keep renaming the files.
I remember having this working in an earlier project but can't figure out what I am missing now.
Finally managed to do this. Leaving a answer in case somebody else is looking for the same. The solution works with Imagemagick 6.5.1.
So we want to extract page numbered i to j from a.pdf into individual jpegs with files named from a-10.jpeg to a-20.jpeg.
convert a.pdf[i-j] -set filename:page "%[fx:t+i]" a-%[filename:page].jpeg
This uses fx operators. fx:t gives the screen number of current image in sequence and we can add our offset to it.
You can specify the first "page" number used by %d in the output filename by adding the -scene n parameter, e.g.:
convert a.pdf[0-9] -scene 10 a-%d.jpeg
will output a-10.jpeg, a-11.jpeg, etc.