Export browse window to MS Word using Stata asdoc - ms-word

How can I export the contents of the Stata browse window to MS Word?
I'm currently using the asdoc command. However, any method outside "copy and paste" is acceptable.
my attempt
ssc install asdoc, replace
sysuse auto
asdoc, row( make, price, mpg, rep78, headroom, trunk, weight, length, turn, displacement, gear_ratio, foreign ) title(Test Table)

You can use the code below to export the current dataset or its subsets to MS Word
ssc install asdoc, replace
sysuse auto
asdoc list make price mpg rep78 headroom trunk weight length turn displacement gear_ratio foreign in 1/10 , replace
to export without inputting the variable names
asdoc list * in 1/10 , replace
and to export the entire dataset, simply remove the in
asdoc list * , replace

The contents of the browse window are just the current dataset, or whatever subset you specify.
Minimally, you may considering using an export command to create a dataset file.
For any output to be readable by MS Word, much hinges on what you might be willing to do without, or other way round, your unstated criteria on what file you expect to be produced.
The following are among details to think about:
browse respects display formats, which do not have to match the precision with which Stata holds data.
browse by default shows value labels when defined. You may wish to export values and value labels.
browse may have difficulty showing very long strings.
The dataset may include objects not shown in the browse window, such as characteristics.

Related

How to force Fields using doc properties variables to update in LibreOffice Writer?

I need to display an adjusted version of the word count in the body of a document.
Right now it's possible to insert the total word count through Insert → Field → More Fields... (Document / Statistics / Words). The entire document will be taken into account when generating this number. This word count is a variable in its own right, WORD, which can be used in math formulas.
So to show the corrected word count I need, excluding the content from the title page etc, I created a new variable with a formula, WORD-8, where 8 is the number of words I'm ignoring. It works, but with one issue.
No matter how I insert this formula (Set Variable, Show Variable, Insert Formula), the resulting number won't update as I keep writing unless it's triggered by:
Editing the paragraph where the formula is present. Editing some other paragraph won't work.
Including the real word count (from the doc statistics tab, not as WORD) somewhere in the document. This prompts a document-wide refresh, successfully triggering the formula update.
Even saving, closing and reopening the document won't update the calculation without one of the two approachs above. Is there another automated way to keep this adjusted word count up-to-date as I write that won't visibly litter the document's body with stuff I don't need? Being forced to display the actual number is what's keeping me from just using the method 2.
Hitting F9 should force updating of fields. Note also that it may be necessary to use Ctrl+Shift+F9 to update any Input Fields in a document. See Shortcut Keys for LibreOffice Writer and Update fields (F9) not working.

Limit number of exported / imported rows in DBeaver

is there a way to limit the number of rows while exporting or imported data in DBeaver?
In my case I have a remote DB2 and I need to import SOME rows of a specific table into a local MySQL DB that I have.
Is there a way to do that?
Thanks
Limiting the number of rows being exported only makes sense if the export wizard knows what rows (e.g. order) to export. Therefore it only makes sense to export the resultset of a query, as opposed to export the actual table with a limiting factor.
This is how you can do this in DBeaver:
Issue a query like SELECT * FROM my_table ORDER BY mycolumn LIMIT n.
Replace n with any integer you like obviously. You may also add
DESC after mycolumn, if only the most recent rows make sense to you.
Run the query.
In the pane with the resultset, locate the button
tooltipped "Export result set to fil or another table". It looks
like a tray with an upward arrow. In DBeaver 7.2.2, it is just left
of the split number and cog buttons.
Run that wizard, selecting "SQL" target type (Export to SQL INSERT statements)
Click Next, and configure any other export preferences (you may leave default too).
The file being exported should content you.

Keep leading zeros when joining data sources in tableau

I am trying to create a data source in Tableau (10.0) where I am joining a table from SQL with an Excel file. The join happens on a site id but when reading the id from the excel source, Tableau strips the leading zeros (and SQL keeps leading zeros). I see this example
to add the leading zeros back as a new, calculated field. But the join is still dropping rows because the id is not properly formatted when making the join.
How do I get the excel data source to read the column with the leading zeros so I can do the join?
Launch Excel and choose to open a new blank workbook.
Click the Data tab and select From Text.
Browse to the saved CSV file and select Import.
Ensure that Delimited is selected and click Next.
Leave Tab as the delimiter and click Next.
Select the column containing the data with leading zeros and click
Text.
Repeat for each column which contains leading zeros.
Click Finish.
Click OK.
Never heard of or used tableau, but it sounds as though something (jet/ace database driver being used to read excel file?) is determining the column to be numeric and parsing the data as numbers, losing leading zeroes
If your attempts at putting them back are giving you grief, I'd recommend trying the other direction instead; get sqlserver to convert its strings to numbers. Number matching should be more reliable than String matching, so long as the two systems don't handle rounding differently :)
If your Excel file was read in from a CSV and the Site ID is showing "Number Stored as Text", I think you can solve your problem by telling Tableau on the Data Source entry that the field is actually a string. On the preview data source view, change the "#" (designating number) to string so that both the SQL source and the Excel source are both strings before doing the join.
This typically has to do with the way Excel stores values as mentioned above. I would play around with the number formatting for the Site ID column in Excel itself, not Tableau, and changed that two "Text" in Excel. You can verify if Tableau will read it properly with the leading 0s by exporting your excel file to csv and looking in the csv files to see if the leading 0s are still there.

Copy data from Spreadsheet[LibreOffice Calc] to tables of Text Document[LibreOffice]

This was very interesting and challenging task for me. I want to copy data (1000s of rows with multiple columns) from Libre Office calc[spreadsheet] to the tables in Libre Office Writer[Text Document]. I spent almost a day to figure out the solution. Couldn't find the solution from any sites.
Copy the data[rows] from Spreadsheet.
Paste the same to the MS Word document[I did it by using Google docs as I'm using ubuntu].The table is created with rows and columns which is same as copied data.
Copy the table from word document and paste it in the Libre office Text Document.
Create the table with number of rows and columns Libre office Text Document.
Copy the table from Libre office Text Document[copied in point(3)] and paste in the table which is created in point(4).
NOTE / CAUTION : If you skip or alter any steps, it wont work.
Converting a column of text (perhaps from a screen-scrape of a online table) to a table format suitable for further work in a spreadsheet is easy if you have the traditional (locally installed) MS-Word program. The "Convert text to table" function there permits you to specify how many columns are in each record without having to edit your input files to manually place delimiters like commas, semi-colons, tabs etc. which is a PITA when you have to count rows to leave out the delimiter.
LibreOffice writer has a lightweight convert-text-to-table function which requires a lot of data conditioning before using it. In Libra Calc, Like any good spreadsheet, the "Transpose" function can be used to convert, say, 8 rows of the input column to a single 8-column row, but automating this requires macros or fixed templates.
So it is a non-trivial problem to duplicate that powerful capability in the old, locally installed MS-Word app, where users can take pages and pages of one-word data elements, and convert them into a "N" column table, where "N" is specified when you invoke the conversion in MS Word.

sql developer export table to xls

How to export the entire query results to xls format without the value truncated (with the header intact).
e.g
the value is round up to 276408428673510000 when the actual value is suppose to be 276408428673508271
Using this method
After selecting the data by clicking 'Ctrl+ A' in gride, use 'Ctrl+Shift+C' to copy the data with Header. After pasting the data into MS Excel, try changing the 'format' to number or text. You must be knowing that 'format cells' is available as a right click option in MS Excel.
My solution was use the LPAD or RPAD functions, you give the exact length that you want and when you export the data, these don't round it.